CALCULATE Error in Measure

WooPig

New Member
Joined
Aug 16, 2010
Messages
5
This is probably pretty basic stuff, but I'm new to DAX and it's got me stumped.

This measure works for finding our most recent record:
MaxCompDt:=CALCULATE(LASTDATE(Completed[Completion Date]),all(Completed))

And this measure works for finding the first day of whatever month that record is from:
1stDOM:=CALCULATE(STARTOFMONTH(LASTDATE(Completed[Completion Date])),all(Completed))

But if I try to use the first measure inside the second measure to replace the LASTDATE part:
1stDOM:=CALCULATE(STARTOFMONTH([MaxCompDt]),all(Completed))

Then I get the "CALCULATE has been used in a true/false expression" error. The two working measures are being used for a DATESBETWEEN calculation, which is working. So really everything works. This is just more a curiosity so that I can learn something.

So I have two questions.

1. Why does this trigger that error?
2. What is best practice here? Should I use the first measure inside the second measure, or is that not a good idea?
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Typically that sorta thing "just works", but as you have seen... sometimes that doesn't work out. I would be curious to see if replacing LASTDATE with MAX makes it work? There are some subtle differences between the two which might help your luck.

Note also, I wouldn't expect the all(completed) on your 1stDOM measure, since MaxCompDt took care of that?
 
Upvote 0
Typically that sorta thing "just works", but as you have seen... sometimes that doesn't work out. I would be curious to see if replacing LASTDATE with MAX makes it work? There are some subtle differences between the two which might help your luck.

Note also, I wouldn't expect the all(completed) on your 1stDOM measure, since MaxCompDt took care of that?

I did try using MAX instead of LASTDATE, but nothing changed. I had another situation last week where using MAX had worked when LASTDATE didn't, but no luck here.
 
Upvote 0

Forum statistics

Threads
1,224,061
Messages
6,176,152
Members
452,707
Latest member
laplajewelry

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top