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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
kjsullivan
Frequent Visitor

YTD Error: An invalid numeric representation of a date value was encountered

I am new to Power BI and I am trying to create a matrix for a report I am building, but keep running into trouble with my YTD. My code for the YTD is as follows: YTD Revenue = TOTALYTD(SUM(Test[Revenue]),'Sheet1'[Renewal Date]). My matrix has my Years in the columns section and Month Name is the rows section. I have two tables, one has all of my data, such as Renewal Date, Year, Index_ID, and Month Name while the other table has the Index_ID to create the relationship and Revenues. The relationship was able to be created, but whenever I go to insert the YTD Revenue into the matrix I get the error of "MdxScript(Model) (3,30) Calculation error in measure 'Sheet1'[YTD Revenue]: AN invalid numeric representation of a date value was encounted. I watched a video created by Power BI and copied wht he was doing, but still recieved this error.

2 REPLIES 2
v-caliao-msft
Employee
Employee

@kjsullivan,

 

You could create a calculated column like below.
Cumulative =
VAR RowDate = Table1[Date]
RETURN
    CALCULATE (
        SUM ( Table1[Recurring] );
        FILTER (
            Table1;
            Table1[Date] <= RowDate
                && YEAR ( Table1[Date] ) = YEAR ( RowDate )
        )
    )

 

Here is a similar issue for you reference
https://community.powerbi.com/t5/Desktop/DAX-Running-Total-YTD/td-p/21576

 

Regards,

Charlie Liao

@v-caliao-msft Thank you for the help, but I had it right the first time. What was messing me up were the NULL values in my data.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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