Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I have created a metric to calculate the sales for last year.
Below is the formula:
LastYear_Sales = CALCULATE(SUM('Fact_Sales'[SALES_AMT]),SAMEPERIODLASTYEAR('Dim_Day'[Date]))
when I create a table with: Date from Dim_Day and LastYear_Sales, I get the following error:
Solved! Go to Solution.
Based on my test, this can be caused by an invalid datetime value that exceeds the year 9999.
I encountered the same issue when working with SAMEPERIODLASTYEAR. It seems like the date table needs to be Marked As Date Table. This did the trick for me.
I encountered the same issue when working with SAMEPERIODLASTYEAR. It seems like the date table should be Marked As Date Table. This did the trick for me.
Based on my test, this can be caused by an invalid datetime value that exceeds the year 9999.
Seems like it does not like your [Date] column. Is it flagged as a numeric field in the data model?
I checked that. It is a date/time field.
Hmm, reading the error more closely, it says MdxScript, is this a Live data source? (DirectQuery)
That function is not supported in DirectQuery mode.
I am using Import mode to fetch data from MySQL.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!