Forum Discussion
Same week previous year
Check if the following link helps.
https://www.sqlbi.com/articles/compare-equivalent-periods-in-dax/
- calimero488 years agoHelper II
Hi
Thank you for your reply. I start with this article.
Let me explain :
Fact table is
Date|Vendor|Manager|Article|Value
2017-01-04|v01|M01|A01|10
2017-01-11|v02|M01|A01|20
2017-01-05|v02|M01|A01|10
2018-01-24|v01|M01|A01|10
2018-01-12|v02|M01|A01|10
With my measure if i do
week / Manager/vendor Previous year same week /Current year week
I got
W1 2017 2018
A01 20 10
V01 ( I do not have sales in 2018 week 1)
V01 10
W2
A01 20 10
V02 20 10 ( I have sales in 2018 week 2)
What i understand is that my measure for the previous week year is taking only week of the current year having sales.
How to avoid this?
Thanks for your help
- calimero488 years agoHelper II
Hi
I have read Marco Russo article
https://www.sqlbi.com/articles/week-based-time-intelligence-in-dax/
What I found, it's when I do not have any value on the current year/week, the measure is not calculated for the previous year.
How to have it working ?
Regards
- calimero488 years agoHelper II
Hi
To go further in the debug, I found that if there is not data for the current year, VALUES ( DAT[WeekNumberOfYear]) return blank.
How can I have the selected weekNumber returned even if there is no data for the current year.
Thanks in advance for your help