Forum Discussion
Same week previous year
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
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
- MojoGene8 years agoPost Patron
Here's a thought.
If you divide the sales figue by itself you will come up with one of two values: 1 or 0 (because anything divided by itself will be 1 and anything divided by zero will be zero). Then multiple the resulting value by your full measure. The result will be either 1 * [MEASURE] or 0 * [MEASURE].
This might return the sales in the current week having no sales as zero as you seem to require. (Sorry I haven't tested this.)
- calimero488 years agoHelper II
Hi
Thanks for your suggestion but my problem is that the measure of the previous year same week does not give the correct result.
the measure "previous year same week" does not include all fact table of the previous year week if, there is no sales in the current year.
Regards