Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi Team,
I have Year, Month and Week Number and Sales , I have to calculate last year sales of the same week.
Year | Month | Week | Sales |
2022 | 1 | 1 | 10 |
2022 | 1 | 2 | 20 |
2022 | 1 | 3 | 30 |
2022 | 1 | 4 | 40 |
2022 | 1 | 5 | 50 |
2023 | 1 | 1 | 60 |
2023 | 1 | 2 | 70 |
2023 | 1 | 3 | 80 |
2023 | 1 | 4 | 90 |
2023 | 2 | 5 | 100 |
Result
Year | Month | Week | Sales | Result |
2022 | 1 | 1 | 10 | |
2022 | 1 | 2 | 20 | |
2022 | 1 | 3 | 30 | |
2022 | 1 | 4 | 40 | |
2022 | 1 | 5 | 50 | |
2023 | 1 | 1 | 60 | 10 |
2023 | 1 | 2 | 70 | 20 |
2023 | 1 | 3 | 80 | 30 |
2023 | 1 | 4 | 90 | 40 |
2023 | 2 | 5 | 100 | 50 |
Thanks in Advance !
Solved! Go to Solution.
@Ahmedx ,
I dont have any other table its just single table and no date column too, It has only Year,MonthNumber & WeekNumber.
Thanks!
you must have a calendar table
if there is a calendar, then you can use
to get the desired result
User | Count |
---|---|
130 | |
108 | |
101 | |
67 | |
62 |
User | Count |
---|---|
137 | |
115 | |
102 | |
71 | |
61 |