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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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