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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Cumulative Calculation Reacting to Date Slicer

Hi All,

 

After scouring the forums my gut feel is I don't think this is possible but would appreciate confirmation/someone smarter than me quickly having a look!

 

Ultimately I want to make a cumulative line chart where the cumulative sum reacts to a date slicer.

 

By that I mean that I am to calculate a cumulative sum, I have managed to do it over groups and static date ranges, however, is it possible to do it so that it reacts to a slicer? As far as I'm aware measures are the only things that re-calculate in reaction to a slicer changing, however, a measure cannot return a table of data so therefore this is impossible?

To include an example, I have a table here of data, imagine I put a date slicer range between 02/01/2023 -> 08/01/2023, my desired result is that the cumulative line that is plotted is a cumulative sum that starts on the 02/01/2023 and ends on the 08/01/2023

(not sure why formatting is weird, the Value column is just a a sequence of 1->10)

DateValueDesired Solution
Date Slicer: 02/01/23 -> 08/01/23
 
01/01/20231  
02/01/202322Plot these values
03/01/202335
04/01/202349
05/01/2023514
06/01/2023620
07/01/2023727
08/01/2023835
09/01/20239  
10/01/202310  


Any help in knowing if this is possible would be greatly appreciated!

 

Thanks in advance!

2 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

This should work even with a single table. 

see attached.

 

View solution in original post

Here's one possible implementation 

 

cumul = 
var mind = CALCULATE(min('Table'[Date]),ALLSELECTED('Table'[Date]))
var maxd = max('Table'[Date])
var a = ADDCOLUMNS(VALUES('Table'[Group]),"sm",CALCULATE(sum('Table'[Value]),'Table'[Date]>=mind,'Table'[Date]<=maxd))
return sumx(a,[sm])

 

see attached

 

Here's another version

cumul = 
var f = filter(ALLSELECTED('Table'),'Table'[Date]<=max('Table'[Date]))
var a = SUMMARIZE(f,[Group],"sm",sum([Value]))
return sumx(a,[sm])

View solution in original post

5 REPLIES 5
lbendlin
Super User
Super User

This should work even with a single table. 

see attached.

 

Anonymous
Not applicable

Thank you! that has worked

How would I adapt this to produce a cumulative sum over a group? For example: for each date I have 8 groups and I want to make the cumulative sum within these?

Please provide sanitized sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.

Anonymous
Not applicable

So if each date had multiple groupings within it I want the cumulative sum to stick to those groups, e.g. slicer set to 03/01/2023 -> 06/01/2023 and there are 3 groups (A/B/C) for each day, I want the cumulative sum of A/B/C across all those selected dates:

DateGroupValueSlicer 03/01/2023 -> 06/01/2023
01/02/2023A1 
01/02/2023B2 
01/02/2023C3 
02/01/2023A1 
02/01/2023B2 
02/01/2023C3 
03/01/2023A11
03/01/2023B22
03/01/2023C33
04/01/2023A12
04/01/2023B24
04/01/2023C36
05/01/2023A13
05/01/2023B26
05/01/2023C39
06/01/2023A14
06/01/2023B28
06/01/2023C312
07/01/2023A1 
07/01/2023B2 
07/01/2023C3 
08/01/2023A1 
08/01/2023B2 
08/01/2023C3 
09/01/2023A1 
09/01/2023B2 
09/01/2023C3 
10/01/2023A1 
10/01/2023B2 
10/01/2023C3 

 

 

Here's one possible implementation 

 

cumul = 
var mind = CALCULATE(min('Table'[Date]),ALLSELECTED('Table'[Date]))
var maxd = max('Table'[Date])
var a = ADDCOLUMNS(VALUES('Table'[Group]),"sm",CALCULATE(sum('Table'[Value]),'Table'[Date]>=mind,'Table'[Date]<=maxd))
return sumx(a,[sm])

 

see attached

 

Here's another version

cumul = 
var f = filter(ALLSELECTED('Table'),'Table'[Date]<=max('Table'[Date]))
var a = SUMMARIZE(f,[Group],"sm",sum([Value]))
return sumx(a,[sm])

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.