Forum Discussion
DAX Measure Query
- 1 year ago
Try
VAR MaxDate = MAX(Calendar_Lookup[Date]) VAR __fyStart = DATE(YEAR(MaxDate), 4, 1) VAR __fyEnd = DATE(YEAR(MaxDate) + 1, 3, 31)That will use the latest date from the filter context.
- 1 year ago
Hi SuzieKidd ,
As correctly pointed by the users, you do not have an active row context on the Calendar_Lookup Table, therefore you get the error.Since you're referencing Calendar_Lookup[Date] directly in a measure without an aggregation, it throws you this error. Measures operate in a filter context, and if that context includes multiple rows, DAX doesn't know which single value to use unless you specify it.
Maybe you want to aggregate first and then use it-VAR __fyStart = DATE(YEAR(MAX(Calendar_Lookup[Date])), 4, 1) VAR __fyEnd = DATE(YEAR(MAX(Calendar_Lookup[Date])) + 1, 3, 31)
Hope this helps!
The reason is that you do not have an active row context on the Calendar_Lookup Table, since a measure does not create a row context on a table, unless you explicit ask so. So you can find the code to use in a measure in the preceding pst by another supporter in the forum, but here is the reason that you were asking for
If this helped, please consider giving kudos and mark as a solution
me in replies or I'll lose your thread
consider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI