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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
cwayne758
Helper IV
Helper IV

SamePeriodLast Year/Contiguous Dates(?)

Hello,

 

So I have our salespeople in a treemap acting as a slicer over the rest of the canvas. I am showing gross revenue and avg. job revenue brought in for this year. I am comparing it to last year using SAMEPERIODLASTYEAR--but i encounter an error when I make a selection on our salespeople.

 

sameperiodlastyear.PNG

 

I'm pretty sure the formula itself is right, but I'd like to understand what's going on behind the scenes that's giving me the error--presumably a filter-context ...?

 

Thanks in advance

2 ACCEPTED SOLUTIONS
LarsSchreiber
Responsive Resident
Responsive Resident

Hi @cwayne758,

 

it's like the error message tells you: SAMEPERIODLASTYEAR requires a contiguous selection of dates in your slicers. If you use the ctrl. key to select different, non-contiguouse dates, than this function does not work, as you noticed.

 

Regards,

Lars

View solution in original post

kcantor
Community Champion
Community Champion

I have used DATEADD -1 successfully in the past to bypass this particular error when the cause was not immediately apparant. 

Are you selecting specific date ranges (maybe skipping holidays or weekends)? This would throw off the calculation and cause the error. The error is basically saying that the dates have to be continuious from start to end with no days skipped.

K





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
kcantor
Community Champion
Community Champion

I have used DATEADD -1 successfully in the past to bypass this particular error when the cause was not immediately apparant. 

Are you selecting specific date ranges (maybe skipping holidays or weekends)? This would throw off the calculation and cause the error. The error is basically saying that the dates have to be continuious from start to end with no days skipped.

K





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




LarsSchreiber
Responsive Resident
Responsive Resident

Hi @cwayne758,

 

it's like the error message tells you: SAMEPERIODLASTYEAR requires a contiguous selection of dates in your slicers. If you use the ctrl. key to select different, non-contiguouse dates, than this function does not work, as you noticed.

 

Regards,

Lars

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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