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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Adding too measures together

Hello

 

I'm creating a chart showing actual expenditure to date and future forecast.

 

I've created two separate measures for:

 

Cumulative payments to date 

 

Cumulative payments = var contextDate = MAX('Calendar'[Date]) var output = CALCULATE( SUM('Money Transfers 201819'[MT amount for charts]), FILTER(ALL('Calendar'[Date]), 'Calendar'[Date] <= contextDate) ) RETURN IF( contextDate <= Today(), output )
 
Cumulative future forecasts
 
Cumulative forecasts in future = CALCULATE(SUM('Forecast Report Oct 2016'[Forecast amount]),FILTER(ALL('Calendar'[Date]),AND('Calendar'[Date]>=DATE(YEAR(TODAY()),MONTH(TODAY()),1),'Calendar'[Date]<=MAX('Calendar'[Date]))))
 
 
When i add both measures to a chart there are two separate lines. 
 
What i would like to do is create a third measure that basically sums these two together. Eg, at the moment, if there are no December forecasts, the cumulative forecast line starts at 0. I would like the latest month's cumulative payments to be added to the future forecasts so the line basically 'keeps going up' rather than dropping down for zero forecasts.
 
I hope this makes sense, i'm only a beginner user. If anyone could help me with a measure to 'add' these separate measures together than would be amazing!
 
Thanks!
7 REPLIES 7
Greg_Deckler
Community Champion
Community Champion

I believe that should just be:

 

Measure 3 = 
VAR __month = MONTH(MAX('Calendar'[Date]))
RETURN
CALCULATE(ALL([Cumulative payments to date]),MONTH('Calendar'[Date])=__month -1 + [Cumulative future forecasts])

Something like that. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Also See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...



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!:
DAX For Humans

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

Hi Greg

 

Thanks for your reply.

 

I've tried using the formula but I get the following error:

 

'A function 'CALCULATE' has been used in a True/False expression that is used as a table filter expression. This is not allowed.'

 

Any ideas what this might means?

 

Thanks!

That means I seriously screwed up my syntax. I think this is what I was going for:

 

Measure 3 = 
VAR __month = MONTH(MAX('Calendar'[Date]))
RETURN
CALCULATE([Cumulative payments to date],FILTER(ALL(Calendar),MONTH('Calendar'[Date])=__month -1) + [Cumulative future forecasts])

Been a long day.



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!:
DAX For Humans

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

Thanks Greg, now i get this error:

 

A function 'FILTER' has been used in a True/False expression that is used as a table filter expression. This is not allowed.

 

Any ideas?

 

Thanks for your help so far!

Shoot, paren in the wrong spot! Syntax...

 

Measure 3 = 
VAR __month = MONTH(MAX('Calendar'[Date]))
RETURN
CALCULATE([Cumulative payments to date],FILTER(ALL(Calendar),MONTH('Calendar'[Date])=__month -1)) + [Cumulative future forecasts]

This is what happens when I don't actually test my DAX code in Power BI and try to wing it.



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!:
DAX For Humans

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

Thanks again for your reply.

 

Unfortunately that measure basically re-creates a line the same as the existing measure for Cumulative Forecasts.

 

I was hoping to get a line that starts from July thats show cumulative payments to date. For example, as at 31 December, the total cumulative figure for the first 6 months would be $1,000,000. The line would then change to Cumulative Forecasts where the January figure would be the $1,000,000 paid to date plus January forecasts. This would then continue on until 30 June.

See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...



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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.