Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
THE SITUATION:
Based upon good advice from @CheenuSing from this post I created a DWY column:
Then I use DWY to calculate sales difference between this year and same day of week last year. For example:
So to get last year sales I use:
THE PROBLEM: My DWY solution no longer works because LY Sales is looking for 50532019 but there is no 50532019.
WHAT I NEED: My DWY statement needs improved to create a unique number solution to account for weird calendar situations like December 31, 2020 vs January 2, 2020.
Any help would be appreciated.
Solved! Go to Solution.
Hi @Quinnie2017 ,
You could try using the measure
Same Week Day Last year =CALCULATE([Sales], dateadd('Date'[Date],-364,Day))
Let me know if this worked for you.
Cheers
CheenuSing
Just ran into this one myself...... Did you come up with a solution for it?
HI @Robbief ,
The solution is in the thread itself. Check it out.
Cheers
CheenuSing
O wow - This works for leap years too.....
Hi @Quinnie2017 ,
You could try using the measure
Same Week Day Last year =CALCULATE([Sales], dateadd('Date'[Date],-364,Day))
Let me know if this worked for you.
Cheers
CheenuSing
Perfect! I thought I might need to change it to this. And this works on a leap year too! Kudos - I will mark as solution and thanks again!
hi @Quinnie2017 , I am assuming that if the corresponding LY week does not exist it should return blank or zero. Have you tried wrapping LY sales with a conditional formula so if LY does not exisit the difference is just the current year?
Proud to be a Super User!
Unfortunately this would not be acceptable as there should always be LY sales in our dataset, thanks for the reply!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
102 | |
84 | |
79 | |
70 |
User | Count |
---|---|
120 | |
110 | |
95 | |
82 | |
77 |