Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hi,
We have an issue when trying to show data from previous year same week.
We understand that date from this year isn't in same week number previous year but would like to override that. Our data is organized week by week and entered in dataset that way (also I'm adding a sample dataset)
When we use SAMEPERIODLASTYEAR(Calendar[Date]) it looks for a Date and offset week (see in example), we also tried the calculation with WeekNumber = WeekNumber && Year = Year(TODAY()) -1 but it gives an error on last week W52 (see in example).
Is there a solution for these types of cases? We use ISO Calendar and is also added here (perhaps there is a solution for using weekly based Calendar table - which will also work for us, since our data is organized week by week).
Thanks,
Dragan
https://www.dropbox.com/s/3ul547c5goob2cw/Test%20Case.pbix?dl=0
Solved! Go to Solution.
Hi
You need to have a column in your date table with the ISO Year as well.
And create an ISO year Week Hierarchy - with iso year and iso week and date
BR
Erik
Hi
You can get inspiration here
https://www.sqlbi.com/articles/week-based-time-intelligence-in-dax/
I typically use a slightly simpler approach by doing like this
SALES VALUE LY = CALCULATE([Sales Value], DATEADD(Date[Date], -364, DAY))
-364 is equal to 52 weeks * 7
Requires as always a date table with all dates
/Erik
I've also tried this approach but the problem is when you look at year 2017 for instance,
you have 2016-W52 and 2017-W52, so if we are to use W52 for instance on axis we will double the data.
We overrided this by hiding 2016-W52, but I believe that there should be a stabile solution,
or it's just Ok to extract year from ISO week and use that as a year filter and not year filter from Calendar.
01.01.2017 is 2016-W52 and it's a Calendar year 2017, so the question is if we use ISO week and our data is entered week by week
(every last week day) should we for filtering ignore Calendar and extract year filter from ISO week and use that as filter
Thanks
Hi
You need to have a column in your date table with the ISO Year as well.
And create an ISO year Week Hierarchy - with iso year and iso week and date
BR
Erik
in this case we used 01st January 2017 as ISO year 2016 since it's W52_2016
and it gave correct result
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 48 | |
| 40 | |
| 38 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 68 | |
| 65 | |
| 30 | |
| 26 | |
| 25 |