Forum Discussion
Filter MAX Date in CALCULATETABLE - Working with hard coded dates, not working using MAX.
Hi All,
I am trying to CALCULATETABLE on a MAX date from a report slicer to give a result set that can be explored and the code is shown below. When hard-coding the date into VAR MaxDate I get the results in the report I want and expect. However when I change this to use MAX(ZZ_CalendarDimension[Date]) with a slicer set to the month of January 2021 the result set is incorrect. The tables are not related in the background as I am looking to determine open items at the start of period that may be different to the Month we are exploring in the report hence the VAR EarliestDate. This will become the MaxDate - 365 days once this issue is resolved.
Any hints greatly appriciated! 😀
1 Reply
- MFelix
Super User
Hi jonathansharman ,
Measures cannot be used on table in your model meaning that your filtering on table will not be applicable.
Measures are based on context and that can change depending on visualizations, filters, slicers, columns used and other different aspectes, tables are calculated based on row context, this means that you cannot get the row context from a measure that can assume multiple values.
In this case you need to create your table within a measure because measures can be used inside other measures to make your calculation that way you can have a measure working within your table context to give you the result you need.