Forum Discussion
First DAX attempt not working - 12m back.
I'm trying to create a visualisation that goes back 12 months from the selected date in a slicer.
I'm working off this video - https://www.youtube.com/watch?v=d8Rm7dwM6gc
My Code so far is:
TRI P12M =
VAR ReferenceDate = MAX ( 'Date'[Date] )
VAR PreviousDates =
DATESINPERIOD (
'Previous Date'[Date],
ReferenceDate,
-12,
MONTH
)
VAR Result =
CALCULATE(
MAX(
'DataFreqRates'[TRI Month]),
PreviousDates,
USERELATIONSHIP ( 'Date'[Date], 'Previous Date'[Date])
)
RETURN
Result
I can follow what the video is saying and what it is trying to do, but I am getting an error - MdxScript(Model) (18, 5) Calculation error in measure 'DataFreqRates'[TRI P12M]: an invalid numeric representation of a date value was encountered.
Which I think is saying I am trying to sum a date, but I'm not sure how or why.
Suspect its cause I'm only new to DAX and am missing something basic.
More Info -
TRI Month is basically a performance metric for the end of the month.
DataFreqRates is the table that calculates several scores.
Can someone point me in the right direction?