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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
uncgmba
Frequent Visitor

relative date filter and sameperiodlastyear

hello!
i am trying to make a simple column chart by invoice date with sales CY and PY sales.  Works fine until i use the Last 90 days filter.  As i understand it, that filter will work in addition to the sameperiodlastyear and effectively eliminate the PY data.  I can't seem to find the exact issue in here but probably just me.  Can anyone point me in the correct direction?  FYI wrapping sameperiodlastyear in ALL isn't ideal because i need other filters slicers to be referenced.

Thanks

4 REPLIES 4
uncgmba
Frequent Visitor

thanks for the response...the time intellgence works just fine until i put in a slicer of trailing 90 days on the date itself.  then PY goes away...i am pretty confident that it is what another person said...the slicer on the date is trumping the sameperiodlastyear function.  Trying to figure out how else to do it.

@uncgmba , That is because of sameperiodlastyear  and last 90 days.

 

So I am suggesting to use Datesytd or previousyear

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

right so back to my question...has anyone figured out a way to handle L90 with CY and PY sales?  Is there some other trick to get that visual to populate but with the remaining slicer definitions intact?
Thanks!

amitchandak
Super User
Super User

@uncgmba , every time intelligence function has way it takes date and work on that. So if you need Current Year Vs Last Year, see if time intelligence with date table can hel p

 

example

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA

 

Also refer why TI Fails : https://www.youtube.com/watch?v=OBf0rjpp5Hw

 

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.

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))

//Only year vs Year, not a level below

This Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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