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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
haianhcao
Regular Visitor

SAMEPERIODLASTYEAR doesn't work with discontinued timeline

I have a Date Table that has a relationship with Sales Forecast table. 

I'm using 2 slicers with month and year columns from the Date Table.

 

My code for Revenue:

 

Revenue = 
VAR Revenue = CALCULATE(SUM('01_Sales Forecast'[Amount]), '02_Opportunity'[Probability]=100)
RETURN IF(ISBLANK(Revenue), 0, Revenue)

 

 

My code for Revenue Last Year:

 

Revenue LY = 
VAR RevenueLY = CALCULATE([Revenue], SAMEPERIODLASTYEAR('00_Date Table'[Date]))
RETURN IF(ISBLANK(RevenueLY), 0, RevenueLY) 

 

 

When I filter the slicer with a continued timeline, everything works fine.

haianhcao_3-1709083232672.png 

haianhcao_4-1709083267078.png

 

However, when I deselect any month in the middle that cause the timeline to be discontinued, my visuals show errors.

haianhcao_2-1709083214792.png

 

How should I fix this?

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@haianhcao , Make sure the join between date table and sales forecast should be single direction. If it bi-directional it can give error like this.

 

If that is not the case share error from view error 

 

 

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-bd52912a5b...
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

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

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

What is the error you see when you click on the See Details hyperlinked text?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@haianhcao , Make sure the join between date table and sales forecast should be single direction. If it bi-directional it can give error like this.

 

If that is not the case share error from view error 

 

 

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-bd52912a5b...
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

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

It works! Thank you. 🙏

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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