Forum Discussion
Need Help with Measure
- 6 years ago
Hi Anonymous ,
Your first measure is evaluated in the context of the second measure. If the second measure is evaluated in a filtered context based on for example Period = 2, then the first measured will evaluate to 2 and not to the overall MAX of period in the table.
I think this will remedy this for you:
Current Report Month:=CALCULATE( MAX(CapitalReportData[PERIOD]), FILTER(ALL(CapitalReportData),CapitalReportData[COST TYPE]="PO") )By using ALL() in your FILTER(), the evaluation context is changed and now this measure will always result in the same value, regardless of the context it is evaluated in (e.g. a matrix visual for example).
Hope that this makes sense, let me know if this helped you!
Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Keep those thumbs up coming! 🙂
Hi Anonymous ,
Your first measure is evaluated in the context of the second measure. If the second measure is evaluated in a filtered context based on for example Period = 2, then the first measured will evaluate to 2 and not to the overall MAX of period in the table.
I think this will remedy this for you:
Current Report Month:=CALCULATE(
MAX(CapitalReportData[PERIOD]),
FILTER(ALL(CapitalReportData),CapitalReportData[COST TYPE]="PO")
)By using ALL() in your FILTER(), the evaluation context is changed and now this measure will always result in the same value, regardless of the context it is evaluated in (e.g. a matrix visual for example).
Hope that this makes sense, let me know if this helped you!
Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Keep those thumbs up coming! 🙂
Thanks for both suggestions. Since the 2nd one was easier to implement, I started with that one and it worked. (Adding ALL to the Filter of the Measure 1. I will need to think about why that worked!
And I understand the point about the date table. The query that generates this data already computes the period based on the date but I guess doing that in the model is a better solution so I will look at that going forward.
Thanks again to both!