DAX Formulas for Rolling 12 Month Ending Sums – YOY % Change

AlphaJava

New Member
Joined
Jul 17, 2015
Messages
11
I am trying to calculate a YOY PMPM % change using the formula below, but I am not getting the expected results. What is wrong with my formula?

(CALCULATE (
CALCULATE (
[PMPM],
FILTER (
ALL ( Calendar ),
Calendar[DateID]
>= MIN ( Calendar[DateID] ) -0
&& Calendar[DateID] <= MAX ( Calendar[DateID] )
)
),
FILTER (
Calendar,
Calendar[Month] < DATE ( 1991, 1, 1 )
|| Calendar[Month] > DATE ( 1992, 11, 1 )
)
) -
(CALCULATE (
CALCULATE (
[PMPM],
FILTER (
ALL ( Calendar ),
Calendar[DateID]
>= MIN ( Calendar[DateID] ) - 11
&& Calendar[DateID] <= MAX ( Calendar[DateID] )
)
),
FILTER (
Calendar,
Calendar[Month] < DATE ( 1991, 1, 1 )
|| Calendar[Month] > DATE ( 1992, 11, 1 )
)
))) / ( CALCULATE (
CALCULATE (
[PMPM],
FILTER (
ALL ( Calendar ),
Calendar[DateID]
>= MIN ( Calendar[DateID] ) - 11
&& Calendar[DateID] <= MAX ( Calendar[DateID] )
)
),
FILTER (
Calendar,
Calendar[Month] < DATE ( 1991, 1, 1 )
|| Calendar[Month] > DATE ( 1992, 11, 1 )
)
)
)
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
I suggest you create an intermediate measure or measures, and check each component is evaluating correctly.
Also DAX Formatter by SQLBI is useful for formatting & making sense of measures with nested functions.

For example the first measure taken from above could be:

Code:
=
CALCULATE (
    CALCULATE (
        [PMPM],
        FILTER (
            ALL ( Calendar ),
            Calendar[DateID]
                >= MIN ( Calendar[DateID] ) - 0
                && Calendar[DateID] <= MAX ( Calendar[DateID] )
        )
    ),
    FILTER (
        Calendar,
        Calendar[Month] < DATE ( 1991, 1, 1 )
            || Calendar[Month] > DATE ( 1992, 11, 1 )
    )
)
By the way, I think the FILTER on Calendar in this first portion of the measure is not needed (as it doesn't actually change the context), but it is needed in the subsequent versions.
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,728
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top