cancel
Showing results for
Did you mean: Frequent Visitor

Cumulative sum of a measure

Hello All,

I am struggling with getting cumulative totals of a measure I created under "GP per WR"

I basically want them to all add up to the previous periods going forward and the closest I got was with this formula which doesn't return correct results:

Cumulative GPH SK =
VAR SK = CALCULATE(FactPeoplePerPeriod[GP per WR],
FILTER(ALL(FactPeoplePerPeriod[periodNumber]), FactPeoplePerPeriod[periodNumber] <= MAX(FactPeoplePerPeriod[periodNumber])))
RETURN
IF(ISBLANK([GP per WR]), BLANK(),SK) Any help would be appreciated

1 ACCEPTED SOLUTION  Super User

Ah, this does make things more clear.

[GP per WR] appears to be a ratio. Thus, the cumulative total is more like a cumulative average than a cumulative sum.

You can get the cumulative sum by iterating over the periodNumber along these lines

SUMX (
FILTER (
ALL ( FactPeoplePerPeriod[periodNumber] ),
FactPeoplePerPeriod[periodNumber] <= MAX ( FactPeoplePerPeriod[periodNumber] )
),
[GP per WR]
)

but I'd take a minute to think about what this calculation actually means and how to interpret the numbers you get since summing ratios often doesn't make much sense (I don't know if it does in your case or not).

4 REPLIES 4  Super User

What results does your attempt give? Frequent Visitor

Hi - Sorry left that out. Here is the results   Super User

Ah, this does make things more clear.

[GP per WR] appears to be a ratio. Thus, the cumulative total is more like a cumulative average than a cumulative sum.

You can get the cumulative sum by iterating over the periodNumber along these lines

SUMX (
FILTER (
ALL ( FactPeoplePerPeriod[periodNumber] ),
FactPeoplePerPeriod[periodNumber] <= MAX ( FactPeoplePerPeriod[periodNumber] )
),
[GP per WR]
)

but I'd take a minute to think about what this calculation actually means and how to interpret the numbers you get since summing ratios often doesn't make much sense (I don't know if it does in your case or not). Frequent Visitor

That worked beautifully. Thank you so much for your help   