Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin 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.
Hi.
I have created a calculated measure using the function SAMEPERIODLASTYEAR but somehow I got the "contiguos date selection" error and I don't know how to fix this.
Thank you for your help.
Daniel Kataoka.
Solved! Go to Solution.
Hi, @Anonymous
SAMEPERIODLASTYEAR is a time-intelligent function, so it is recommended to perform this function on a calendar table containing consecutive dates.
Make sure you use
CALCULATE([Measure], SAMEPERIODLASTYEAR(Calendar[Date]))
rather than
CALCULATE([Measure], SAMEPERIODLASTYEAR(Facttable[Date]))
You can also try using filter and DATEADD . The dates returned by SAMEPERIODLASTYEAR are the same as the dates returned by this equivalent formula: DATEADD(dates, -1, year)
Other related threads:
Function 'SAMEPERIODLASTYEAR' expects a contiguous selection Issue
Contiguous date selection error - YTD LY
sameperiodlastyear only works with contiguous date selection
Best Regards,
Community Support Team _ Eason
Hi, @Anonymous
SAMEPERIODLASTYEAR is a time-intelligent function, so it is recommended to perform this function on a calendar table containing consecutive dates.
Make sure you use
CALCULATE([Measure], SAMEPERIODLASTYEAR(Calendar[Date]))
rather than
CALCULATE([Measure], SAMEPERIODLASTYEAR(Facttable[Date]))
You can also try using filter and DATEADD . The dates returned by SAMEPERIODLASTYEAR are the same as the dates returned by this equivalent formula: DATEADD(dates, -1, year)
Other related threads:
Function 'SAMEPERIODLASTYEAR' expects a contiguous selection Issue
Contiguous date selection error - YTD LY
sameperiodlastyear only works with contiguous date selection
Best Regards,
Community Support Team _ Eason
@Anonymous , You should always use a date table, joined with your table on a date having a single directional join.
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-bd52912a5bd4
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.
Hi, @amitchandak.
Tks for your answer.
I already have a date table joined with my fact/s but I also created another table called SpecialDates where I joined with the column date from the date table.
The SpecialDates table is a table with custom dates: all months (jan, feb, mar, apr..) and anothers custom dates (Last Month, 1 Semester, 2 Semester, YTD, Full Year..)
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
11 | |
10 | |
10 | |
9 |
User | Count |
---|---|
18 | |
13 | |
12 | |
11 | |
8 |