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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
lekkerbek
Helper IV
Helper IV

Sameperiodlastyear and Dateadd not giving correct result

Hi all,

 

I hope someone can help me. I know what the problem is, but I don't know how to solve it.

 

I have a situation where there are 13 periods in a year. The data that is imported is not on a daily basis, but imported on the last day of that period through an Excel file. So what I have for example is:

 

data on 26 January 2020

data on 24 January 2021

 

If I choose sameperiodlastyear or dateadd -1 year to compare it shows blanks. Obviously because it compares 24 January 2021 to 24 January 2020 (which has no data).

 

Is there a way to work around this?

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@lekkerbek , I think you need 364 day behind year 28*13

 

example

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-364,Day))

 

make sure you use date table

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

View solution in original post

2 REPLIES 2
lekkerbek
Helper IV
Helper IV

@amitchandak thank you very much. That was it!

amitchandak
Super User
Super User

@lekkerbek , I think you need 364 day behind year 28*13

 

example

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-364,Day))

 

make sure you use date table

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.