Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
powerbienthuzi
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)

 

powerbienthuzi_0-1634157203825.png

 

Any help would be appreciated

 

1 ACCEPTED SOLUTION

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).

View solution in original post

5 REPLIES 5
AlexisOlson
Super User
Super User

What results does your attempt give?

Hi - Sorry left that out. Here is the results 

results.PNG

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).

I have the problem that I want to make a cumulative sum of a measure, but of different SKU's, without taking into account dates.

What would be the solution using the same data, but if the "periodNumber" column, instead of being numbered from 1 to 17, were 17 different SKU's with different numbers and letters?

That worked beautifully. Thank you so much for your help 

 

thankyou.PNG

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors