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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
mechaloupi
New Member

Error when using Sameperiodlastyearwith filter

Hi everybody, 

i want to  compare  sales data between current year and the last year , i used the follwing DAX Formula : 

 

  • TOTAL SALES = sum('Sales DB'[Sales] )
  • Total Sales LY = CALCULATE([Total Sales];SAMEPERIODLASTYEAR('Date'[DATE]))

When i don't usefilters ( by sector , by product , by product category )the two formula works very well , but  when  i filter my data by sector or client for exemple   the  first formula works , but  the last year formula retunr an error as in the attachement. 

 

someone can help me?

 err.JPG

1 ACCEPTED SOLUTION

i found this solution in forum 

If it is a measure which is using any date function which expects contiguous date range, bi-directional filter ends up removing some dates and thus its no longer a contiguous date range which could be crashing the measure.

Both Cross Filter Direction for date is not yet supported. Therefore they have designed an error, which is the one we see here. Once you change the Cross Filter Direction to Single, there is nothing that isn't supported anymore, therefore the error goes away.

View solution in original post

3 REPLIES 3

I can’t see all the images, but the last image/error suggests your date table doesn’t have a contiguous date range. Readthe rules at my blog. 

 

https://exceleratorbi.com.au/power-pivot-calendar-tables/



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

thanks Matt for  replying , my date table have a coniguous date range , with no missing dates  and  no duplicate dates , my formula works perfectely whene i clear all  filter .  or whene the current year have no sales , but  if i use filter , my table  return  this error . 

 

i found this solution in forum 

If it is a measure which is using any date function which expects contiguous date range, bi-directional filter ends up removing some dates and thus its no longer a contiguous date range which could be crashing the measure.

Both Cross Filter Direction for date is not yet supported. Therefore they have designed an error, which is the one we see here. Once you change the Cross Filter Direction to Single, there is nothing that isn't supported anymore, therefore the error goes away.

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Kudoed Authors