cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Plato Frequent Visitor
Frequent Visitor

Cumulative Total with Max Date Filter

Hi 

I'm very new to PowerBi and need some help with the Cumulative Sum Dax formula. I have the following table of Measures created to show Cumulative Sales for current year (Actual), LY and Budget. The data and formula appears correct.

Image1.PNGMeasures for Cumulative Sales

However, when I select a specific Month in the slicer, eg Apr, I get incorrect figures for the cumulative totals.

Image2.PNG

I'm not sure what is wrong and hope someone can help me with this. I've used the following measure for Sales Actual and YTD Sales Actual:

 

Sales Actual = CALCULATE(SUM(SalesData[Sales]),FILTER(SalesData,SalesData[Scenario]="Actual"))
 
YTD Sales Actual = CALCULATE([Sales Actual],FILTER(ALLSELECTED(Dates),Dates[Date] <= MAX(Dates[Date])))
 
Many Thanks.

 

2 ACCEPTED SOLUTIONS

Accepted Solutions

Re: Cumulative Total with Max Date Filter

Hello,

 

Your cumulative measure should be something like this;

 

Cumulative Sales Amount =
VAR _MaxDate =
    MAX ( 'Dates'[Date] )
VAR _Result =
    CALCULATE ( [Sales Actual], 'Calendar'[Date] <= _MaxDate )
RETURN
    _Result

View solution in original post

Plato Frequent Visitor
Frequent Visitor

Re: Cumulative Total with Max Date Filter

This is now solved. I changed from ALLSELECTED to ALL. 

A similar issued was already solved in attached.

 https://community.powerbi.com/t5/Desktop/Slicer-selection-changes-the-cumulative-total/td-p/655657.

 

I managed to solve this by changing from ALLSELECTED to ALL.  My apologies, I should have reviewed existing forum posts more thoroughly. Thanks

 

 

View solution in original post

3 REPLIES 3

Re: Cumulative Total with Max Date Filter

Hello,

 

Your cumulative measure should be something like this;

 

Cumulative Sales Amount =
VAR _MaxDate =
    MAX ( 'Dates'[Date] )
VAR _Result =
    CALCULATE ( [Sales Actual], 'Calendar'[Date] <= _MaxDate )
RETURN
    _Result

View solution in original post

Plato Frequent Visitor
Frequent Visitor

Re: Cumulative Total with Max Date Filter

This is now solved. I changed from ALLSELECTED to ALL. 

A similar issued was already solved in attached.

 https://community.powerbi.com/t5/Desktop/Slicer-selection-changes-the-cumulative-total/td-p/655657.

 

I managed to solve this by changing from ALLSELECTED to ALL.  My apologies, I should have reviewed existing forum posts more thoroughly. Thanks

 

 

View solution in original post

Plato Frequent Visitor
Frequent Visitor

Re: Cumulative Total with Max Date Filter

Thank you avendarschildren. I've tried your solution and it has worked!

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 329 members 2,897 guests