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
kaylastarr
Advocate V
Advocate V

Creating a cumulative measure that only displays up to current date

Hello,

 

I am looking to create a chart similar to this one in excel

kaylastarr_0-1677796604288.png

 

I have been able to create the Plan line without any issue but the "Actual Cumulative" line is giving me problems. My data has values for the whole year because we are forecasting out. But I only want to include in the measure values from before today. 

I am using the folling measure to get the cumulative values

 

Running Savings = CALCULATE(sum('Project Lists'[Savings]),All('Calendar'[Date]),'Calendar'[Date]<=max('Calendar'[Date]) && 'Calendar'[Date]<=today(),'Project Lists'[Project Stage]<>"Hopper")

 

This measure results in the values no longer cumulating after today, but they are still populated for the full year, resulting in a graph like below 

kaylastarr_1-1677796748756.png

How can I only graph, the measure for current dates?

I have a seperate Dates table that I am using for the X Axis. 

 

Here is an example of my data

Project NameDateSavings
Pumps 111246-20 scrap reduction1/15/20230
TX Offsite Storage1/15/20230
EPM_2023_0151/15/20235000
Reduce Shared Services spend for SAP head1/15/20238000
Remote Resolution Tech Support1/15/20230
Reduce Shared Services spend for SAP head2/15/20238000
Remote Resolution Tech Support2/15/20230
TX Offsite Storage2/15/20230
Pumps 111246-20 scrap reduction2/15/20230
EPM_2023_0152/15/20235000
Pumps 111246-20 scrap reduction3/15/20230
EPM_2023_0153/15/20235000
TX Offsite Storage3/15/20230
Remote Resolution Tech Support3/15/20230
Reduce Shared Services spend for SAP head3/15/20238000
Reduce Shared Services spend for SAP head4/15/20238000
EPM_2023_0154/15/20235000
TX Offsite Storage4/15/20231000
Pumps 111246-20 scrap reduction4/15/20230
Remote Resolution Tech Support4/15/20230
Remote Resolution Tech Support5/15/20230
Reduce Shared Services spend for SAP head5/15/20238000
Pumps 111246-20 scrap reduction5/15/20230
1 ACCEPTED SOLUTION
kaylastarr
Advocate V
Advocate V

Just wanted to let everyone know that I was able to get it to work using this measure

Running Savings = 

Var Savings = CALCULATE(sum('Project Lists'[Savings]),All('Calendar'[Date]),'Calendar'[Date]<=MAX('Calendar'[Date]),'Project Lists'[Project Stage]<>"Hopper", USERELATIONSHIP('Calendar'[Date],'Project Lists'[Date]))
Return If(Max('Calendar'[Date])<=TODAY(),Savings,Blank())

 

I think I had to specify which date to use. 

kaylastarr_0-1678231665195.png

 

 

View solution in original post

4 REPLIES 4
kaylastarr
Advocate V
Advocate V

Just wanted to let everyone know that I was able to get it to work using this measure

Running Savings = 

Var Savings = CALCULATE(sum('Project Lists'[Savings]),All('Calendar'[Date]),'Calendar'[Date]<=MAX('Calendar'[Date]),'Project Lists'[Project Stage]<>"Hopper", USERELATIONSHIP('Calendar'[Date],'Project Lists'[Date]))
Return If(Max('Calendar'[Date])<=TODAY(),Savings,Blank())

 

I think I had to specify which date to use. 

kaylastarr_0-1678231665195.png

 

 

Ashish_Mathur
Super User
Super User

Hi,

This simple measure should do the job.

Running Savings = if(EOMONTH(today(),0)<=min('calendar'[Date]),CALCULATE(sum('Project Lists'[Savings]),DATESYTD('Calendar'[Date],"31/12"),'Project Lists'[Project Stage]<>"Hopper"))

To your visual, ensure that you drag Year and Month name from the Calendar Table.

Hope this helps.


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

Hello, This solution results in an inverted line. All values but the previous months are filled in, and there is no running total

kaylastarr_0-1678230150116.png

 

amitchandak
Super User
Super User

@kaylastarr , Try like

 

Running Savings = if(max('Calendar'[Date]) <=today(), CALCULATE(sum('Project Lists'[Savings]),All('Calendar'[Date]),'Calendar'[Date]<=max('Calendar'[Date]) \ ,'Project Lists'[Project Stage]<>"Hopper"), blank())

 

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.