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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

SamePeriodLastYear

Hello,

 

I have a measure -- Net_Sales_SPLY = Calcuate(Sum('Table'[SalesAmt]), SAMEPERIODLASTYEAR('CalendarTable'[Date]))

and get the following error every so often.

Not able to fully understand the error message or solve the issue.

I have also tried DateAdd -1 Year - but not able to solve the problem.  

Will greatly appreciate some input.

Many thanks,

Pavan

 

pkbidani_0-1651107625470.png

 

 

 

 

 

8 REPLIES 8
tamerj1
Super User
Super User

Hi @Anonymous 

you may try

Net_Sales_SPLY =
CALCULATE (
    SUM ( 'Table'[SalesAmt] ),
    SAMEPERIODLASTYEAR ( 'CalendarTable'[Date] ),
    CROSSFILTER ( 'Table'[Date], 'CalendarTable'[Date], 3 )
)
Anonymous
Not applicable

Thanks tamerj1.

It is not breaking any more, but the numbers don't seem right.

I should have mentioned earlier that the date in the Table[Sales Amt] is a week ending date, and the date in the Calendar table is a daily date.  Not sure if this matters or not.

Thanks again!

Hi @Anonymous 
Would you please share a screenshot of your table visual?

Anonymous
Not applicable

pkbidani_0-1651112980780.png

 

@Anonymous 
Sorry I mean the report visual. Can you share the results you are getting? What are you slicing by in your report? The Date column from the calendar table or from the sales table?

amitchandak
Super User
Super User

@Anonymous , You seem to have bidirectional join with with date table, make that single directional.

 

Also make sure calendar table is marked as date table

 

Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5bd4

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thanks amitchandak.

It is not breaking any more, but the numbers don't seem right.

I should have mentioned earlier that the date in the Table[Sales Amt] is a week ending date, and the date in the Calendar table is a daily date.  Not sure if this matters or not.

Thanks again!

@Anonymous , the Same week can fall in a different month. Unless you have 445 calendar. But based on weekend date falling in month total should be correct

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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