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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Anonymous
Not applicable

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.

Measures for Cumulative SalesMeasures 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
avanderschilden
Resolver I
Resolver I

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

Anonymous
Not applicable

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
Anonymous
Not applicable

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

 

 

avanderschilden
Resolver I
Resolver I

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
Anonymous
Not applicable

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

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors