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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Need help with Cumulative Total at the Date Grain where date is missing

Hi All,

                I am trying to add a cumulative total measure for my corresponding Sum Measure.

While it is working in standard situation where months/dates are involved its not working in the date grain of my dataset.

 

For some reason it is introducing Blanks and i need to eliminate them to show the cumulative sum.

Unlike the traditional datasets, this data is not available for all dates but need help in addressing the problem.

 

Measure I Used :

Cumulative Total = CALCULATE([xxMeasureXX],
                          FILTER(ALLSELECTED(DIM_Date[Date]),DIM_Date[Date]<=MAX(DIM_Date[Date])))

 

Karthigeyan_S_0-1708009358653.png

 

Without the Cumulative Sum the normal measure returns data for the available dates :

Karthigeyan_S_1-1708009451200.png

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@Anonymous Try something like this:

Better RT = 
  VAR __Date = MAX('DIM_Date'[Date])
  VAR __Table = FILTER(ALL('Table'), [Date] <= __Date)
  VAR __Result = SUMX( __Table, [Column])
RETURN
  __Result



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Greg_Deckler
Super User
Super User

@Anonymous Try something like this:

Better RT = 
  VAR __Date = MAX('DIM_Date'[Date])
  VAR __Table = FILTER(ALL('Table'), [Date] <= __Date)
  VAR __Result = SUMX( __Table, [Column])
RETURN
  __Result



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

For my issue, the soluion worked with ALLSELECTED rather than ALL 

Better RT = 
  VAR __Date = MAX('DIM_Date'[Date])
  VAR __Table = FILTER(ALLSELECTED('Table'), [Date] <= __Date)
  VAR __Result = SUMX( __Table, [Column])
RETURN
  __Result
amitchandak
Super User
Super User

@Anonymous , Because cumulative will give data for the dates not having any data

 

Add additional filter and try

Cumulative Total = CALCULATE([xxMeasureXX],
FILTER(ALLSELECTED(DIM_Date[Date]),DIM_Date[Date]<=MAX(DIM_Date[Date])) , not(isblank( Table[Date] )) )

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

Thanks for your support. For my data set the other solution with SUMX was able to get the desired result.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.