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

Dax for Cumulative sum of a measure on line chart

 

 

I have following measure that counts distinct clients for a condition:

M1 = CALCULATE(DISTINCTCOUNT(table(client_id), filter(table,table[Served?] ="Yes" )) 

I want to show cumulative sum values over months(I have a datedim table) of this measure on a line chart.

Please suggest how can I do it?

 

My sample pbi file: https://1drv.ms/u/s!Ag919_pO_UKrgQbUO5qfsTPxwfY8?e=gmwvsD

 

Thanks in advance.

2 ACCEPTED SOLUTIONS

Change MAX(Datedim[Date]) to MAX(Test_table[date]))

View solution in original post

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


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

View solution in original post

5 REPLIES 5
camargos88
Community Champion
Community Champion

Hi @Anonymous ,

 

Try this measure:

M2 = CALCULATE(DISTINCTCOUNT(Test_table[Client id]), FILTER(ALL(Datedim[Date]), Datedim[Date] <= MAX(Datedim[Date])), Test_table[Served?] = "Y")

 

 Capture.PNG



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Anonymous
Not applicable

@camargos88 thanks it works! If you can answer this for me I'll be very thankful- How can I limit this cumulative sum to the current month on the graph, so that it shows the cumulative sum only till October 2020 not for the rest of the months in the year-nov, dec.

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


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

@Anonymous ,

 

You can change the measure for it:

 

M2 = CALCULATE(DISTINCTCOUNT(Test_table[Client id]), FILTER(ALL(Datedim[Date]), Datedim[Date] <= MAX(Test_table[date])), Test_table[Served?] = "Y")

 

 

or change you datedim to the max date of test_table. 

 

Datedim = CALENDAR(DATE(2020,1,1), MAX(Test_table[date]))


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Change MAX(Datedim[Date]) to MAX(Test_table[date]))

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