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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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.

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.

It works! Thank you. 🙏

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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