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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
DarrenLau
Advocate I
Advocate I

Cumulative Sum - What am I missing?

Trying to get a cumulative sum (and then a cumulative percentage) value into a matrix table, but I am just not able to get the correct calculations. Here are 3 different combinations (amongst the many others that I have tried) as examples:-

 

Example 1:-

Cumulative1.PNG

Cumulative Disti Net Sales = 
CALCULATE( [Disti Net Sales], 
    FILTER ( 
        ALLSELECTED ( 'Sales Data' ),
        'Sales Data'[Index] <= MAX ( 'Sales Data'[Index] )
    )
)

 

Example 2

Cumulative2.PNG

Cumulative Disti Net Sales = 
CALCULATE( [Disti Net Sales], 
    FILTER ( 
        ALLSELECTED ( 'DateDimension' ),
        DateDimension[FullDateAlternateKey] <= MAX ( DateDimension[FullDateAlternateKey] )
    )
)

Example 3

Cumulative3.PNG

Cumulative Disti Net Sales = 
CALCULATE( [Disti Net Sales], 
    FILTER ( 
        ALLSELECTED ( 'Sales Data' ),
        'Sales Data'[Ship To Cust Id] <= MAX ( 'Sales Data'[Ship To Cust Id] )
    )
)

What am I missing or not doing correctly?

 

I have successfully created a cumulative measure that maps out sales over time (using the date table & date field), but not sure what I am doing wrong here.

 

Edit/Addition clarification:-

Disti Net Sales = sum ( 'Sales Data'[Invoice-Doc] )
2 ACCEPTED SOLUTIONS
Ashish_Mathur
Super User
Super User

Hi,

Try these measures

Rank = if([Disti Net Sales] = BLANK(),BLANK(),RANKX(ALL('Sales data'[City]),[Disti Net Sales]))

Cumulative Disti Net sales = SUMX(TOPN([Rank],CALCULATETABLE(VALUES('Sales data'[City]),ALL('Sales data'[City])),[Disti Net Sales]),[Disti Net Sales])

Cumulative Disti Net sales (%) = [Cumulative Disti Net sales]/CALCULATE([Cumulative Disti Net sales],all('Sales data'[City]))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Hi @Ashish_Mathur ,

 

Thank you for the measures. The cumulative % measure was not working, but I edited it to :-

 

Cumulative Disti Net Sales % = 
DIVIDE( [Cumulative Disti Net Sales] ,
    CALCULATE(SUM('Sales Data'[Invoice-Doc]), ALL('Sales Data'[City])) , 
    BLANK()
)

And it's showing the cumulative percentages now.

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

Try these measures

Rank = if([Disti Net Sales] = BLANK(),BLANK(),RANKX(ALL('Sales data'[City]),[Disti Net Sales]))

Cumulative Disti Net sales = SUMX(TOPN([Rank],CALCULATETABLE(VALUES('Sales data'[City]),ALL('Sales data'[City])),[Disti Net Sales]),[Disti Net Sales])

Cumulative Disti Net sales (%) = [Cumulative Disti Net sales]/CALCULATE([Cumulative Disti Net sales],all('Sales data'[City]))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur ,

 

Thank you for the measures. The cumulative % measure was not working, but I edited it to :-

 

Cumulative Disti Net Sales % = 
DIVIDE( [Cumulative Disti Net Sales] ,
    CALCULATE(SUM('Sales Data'[Invoice-Doc]), ALL('Sales Data'[City])) , 
    BLANK()
)

And it's showing the cumulative percentages now.

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
DarrenLau
Advocate I
Advocate I

Bumping up to see if anyone has any thoughts or ideas. Thank you.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors