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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
learner03
Post Partisan
Post Partisan

Cumulative sum Based on Measure

How can I get the desired Cumulative Sum Column?

To be noted that The Location Count column result is calculated Measure and is not directly coming from a column

 

akapoor03_0-1655876265129.png

 

1 ACCEPTED SOLUTION

Hi @learner03,

 

After hours of research, I hope I have found the solution. Take note that is not my original. It is derived from the proposed solution of  Ashish_Mathur on https://community.powerbi.com/t5/Desktop/Filtering-and-ADDCOLUMNS-field-containing-a-cumulative-sum-... 

 

 

LocCount Rank = 
RANKX ( ALL ( Data[Order Number] ), [Location sum],, ASC )
//Rank [Order Number] by Location count 
Cumulative total = 
SUMX (
    TOPN (
        [LocCount Rank],
        CALCULATETABLE ( VALUES ( Data[Order Number] ), ALL ( Data[Order Number] ) ),
        [LocCount Rank], ASC
    ),
    [Sum of Value]
)

 

danextian_0-1655904503002.png

 

sample pbix - https://drive.google.com/file/d/1J_lt38GY3QhY2GJ_numIt7a37j_IBWMl/view?usp=sharing 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

3 REPLIES 3
danextian
Super User
Super User

Hi @learner03 ,

 

Below are example formula on how to calculate cumulative value. The calculation is based on the alphabetical sorting of order number column.

Cumulative Value - Measure = 
CALCULATE (
    SUM ( Data[Value] ),
    FILTER ( ALL ( Data ), Data[Order Number] <= MAX ( Data[Order Number] )
)
)
Cumulative Value - Column = 
CALCULATE (
    SUM ( Data[Value] ),
    FILTER ( ALL ( Data ), Data[Order Number] <= EARLIER ( Data[Order Number] ) )
)

danextian_0-1655880978448.pngdanextian_1-1655880991097.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi @danextian The place where you are using -SUm(Data[Value])..I cannot do it because my Location Count Column is a measure and your value column is a column here.

Is there any other work around?

Hi @learner03,

 

After hours of research, I hope I have found the solution. Take note that is not my original. It is derived from the proposed solution of  Ashish_Mathur on https://community.powerbi.com/t5/Desktop/Filtering-and-ADDCOLUMNS-field-containing-a-cumulative-sum-... 

 

 

LocCount Rank = 
RANKX ( ALL ( Data[Order Number] ), [Location sum],, ASC )
//Rank [Order Number] by Location count 
Cumulative total = 
SUMX (
    TOPN (
        [LocCount Rank],
        CALCULATETABLE ( VALUES ( Data[Order Number] ), ALL ( Data[Order Number] ) ),
        [LocCount Rank], ASC
    ),
    [Sum of Value]
)

 

danextian_0-1655904503002.png

 

sample pbix - https://drive.google.com/file/d/1J_lt38GY3QhY2GJ_numIt7a37j_IBWMl/view?usp=sharing 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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