Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
CityZ3n
Frequent Visitor

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?

0 REPLIES 0

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.