Forum Discussion
Problems with IF when comparing a Column Value to a Measure
Hi - Any help is gratefully appreciated. I've been looking at this problem for a few hours now and am stumped.
The Position
I have the following measures set to a format of Short Date
FY End = LASTDATE(CalendarLookup[Calendar_Date])
FY Start = FIRSTDATE(CalendarLookup[Calendar_Date])
CalendarLookup is an XLSX doc table.
Hi,
Do you happen to have a relationship between your calendar table and maintance forecast? If you reference measures in a calculated column they will be evaluated in the columns filter context. and thus they will return the date used in the realtionship. If you add ALL to your end and start measures your calculations should work. This picture might elaborate what I mean (here I used LASTDATE measure and placed it in a calculated column):FY End = CALCULATE(LASTDATE(CalendarLookup[Calendar_Date]),ALL(CalendarLookup[)) Should work.
I hope this helps and if it does consider accepting this post as a solution and giving it a thumbs up!
2 Replies
- ValtteriN
Community Champion
Hi,
Do you happen to have a relationship between your calendar table and maintance forecast? If you reference measures in a calculated column they will be evaluated in the columns filter context. and thus they will return the date used in the realtionship. If you add ALL to your end and start measures your calculations should work. This picture might elaborate what I mean (here I used LASTDATE measure and placed it in a calculated column):FY End = CALCULATE(LASTDATE(CalendarLookup[Calendar_Date]),ALL(CalendarLookup[)) Should work.
I hope this helps and if it does consider accepting this post as a solution and giving it a thumbs up! - Spike_CraibRegular Visitor
Hi ValtteriN
Thanks for the reply. I don't have a relationship between the tables. I did try the ALL but it didn't solve my problem.
However, your suggestion of moving the measure into a calculated column did work. I moved it into the MaintenanceForecast table and that problem has now been fixed. Thank you so much for the suggestion.