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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Cumulative Sum Measure

Hi,

 

I've made below measure for Cumulative Sales. However I want it slightly different so that when I select for example Months 7, 8 and 9, it only shows cumulative sales as from Month 7 on. So, not showing values € 28.814.316,37 (Month 7), € 30.580.458,70 (Month 8), € 33.891.502,57 (Month 9) but values € 3.315.379,87 (Month 7), € 5.081.522,20 (Month 8 -->  € 3.315.379,87 + € 1.766.142,33) and € 8.392.566,07 (Month 9 --> € 5.081.522,20 + € 3.311.043,87). 

 

Does someone have an idea how to change the measure?

 
Thanks in advance!
 
*Net Sales Cumulative =
CALCULATE (
    [Net Sales],
    FILTER (
        ALL ('Invoice Date'),
        'Invoice Date'[DateFull] <= MAX ('Invoice Date'[DateFull])
            && 'Invoice Date'[YearId] = MAX ('Invoice Date'[YearId])
    )
)
DM_95_0-1667554316295.pngDM_95_2-1667554657625.png
1 ACCEPTED SOLUTION

@Anonymous Should be able to use something along the lines of IF(COUNTROWS(ALLSELECTED('Table')) = 1, <net sales goes here>, <cumulative measure goes here>)



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@Greg_Deckler Thank you! 

 

I want to use this cumulative measure in another measure as mentioned below (the idea is to switch to cumulative values (VAR _Cumulative) when more than 1 month is selected. If only 1 month is selected, it needs to show the Net Sales(=SUM(Sales[SalesAmount])). However, it does not work properly. Do you have an idea how it might work?

 

*Net Sales VAR =
VAR _Count = COUNTROWS(VALUES('Invoice Date'[MonthInYear]))
VAR _Cumulative = 
CALCULATE (
    [Net Sales],
    FILTER (
        ALLSELECTED ('Invoice Date'),
        'Invoice Date'[DateFull] <= MAX ('Invoice Date'[DateFull])
            && 'Invoice Date'[YearId] = MAX ('Invoice Date'[YearId])
    )
)
RETURN
IF(_Count=1, [Net Sales], _Cumulative)
 

DM_95_0-1667563370459.png

 

@Anonymous Should be able to use something along the lines of IF(COUNTROWS(ALLSELECTED('Table')) = 1, <net sales goes here>, <cumulative measure goes here>)



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Community Champion
Community Champion

@Anonymous Try using ALLSELECTED vs. ALL



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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
Top Kudoed Authors