Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi all,
I have an issue with the 'Sameperiodlastyear' DAX formular. my initial data table looks something like this:
| Date | Start of the week | Year | week | sales |
| 19.05.2019 | 14.05.2019 | 2019 | 20 | 1 |
| 20.05.2019 | 20.05.2019 | 2019 | 21 | 2 |
| ... | ... | ... | ... | ... |
It has all the week from 01.01.2018 (week one of 2018) to 17.05.2020 (week 2020)
Furthermore, from the same table I retriev the total sum of sales. Now I would like to create a table that looks like this:
| Year | Total Sales | SamePeriodlastyear |
| 2018 | 500 | |
| 2019 | 1000 | 500 |
| 2020 | 200 | 1000 |
But what I receive is this:
| Year | Total Sales | SamePeriodlastyear |
| 2018 | 500 | 500 |
| 2019 | 1000 | 300 |
| 2020 | 200 |
The 300 and 500 are the issues here. For 2020 my data inlcudes sales including week 20. So I would expect the same period last year function to also show just the first 20 weeks. But for some reason it includes 22 weeks.
My Formulars are Total= SUMX(Category,Category[Value])and CALCULATE( [total]; SAMEPERIODLASTYEAR(Date;Date[StartofWeek])
Ho das powerbi figures out the
what could be the issue tah powerbi includes 22 weeks for 2019 rather than 20 and ho can i display the number for 2019 in 2020 ,..
greeting
Solved! Go to Solution.
@Greg_Deckler Thanks for the tip. I will try it later on.
I found another way that works as well.
weeklysales = calculate([ValueTotalCategory];Filter(ALL('Date');'Date'[CalendarYear]=SELECTEDVALUE('Date'[CalendarYear])-1 && 'Date'[Week]=SELECTEDVALUE('Date'[Week])))
@dats - See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...
@Greg_Deckler Thanks for the tip. I will try it later on.
I found another way that works as well.
weeklysales = calculate([ValueTotalCategory];Filter(ALL('Date');'Date'[CalendarYear]=SELECTEDVALUE('Date'[CalendarYear])-1 && 'Date'[Week]=SELECTEDVALUE('Date'[Week])))
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.