Forum Discussion
Last 4 weeks sales from specific date
Hi,
Assuming the relationships are set up properly, create a Date slicer from the Calendar Table and select 18/2/2024 there. Now write this measure to get the total sales for the 4 weeks period ended the selected date
Measure = CALCULATE(sum('Sales Accumulation'[Dollar Sales]),Datesbetween('Calendar',min(calendar[date])-27,max(calendar[date])))
Hope this helps.
Hi Ashish,
Sorry - I thought I had given a reply and when looking, I did not see it in the post.
I did try it and it came up with a dax error based.
I was able to use:
| Week Ending | Sales | ||||||||
| 12/24/2023 | 100 | ||||||||
| 12/31/2023 | 150 | ||||||||
| 1/7/2024 | 200 | ||||||||
| 1/14/2024 | 350 | ||||||||
| 1/21/2024 | 100 | ||||||||
| 1/28/2024 | 125 | ||||||||
| 2/4/2024 | 200 | ||||||||
| 2/11/2024 | 250 | ||||||||
| 2/18/2024 | 205 | Key Date = 2/15/2025 | |||||||
| 2/25/2024 | 180 | 4 Week Prior = 780 | |||||||
| 3/3/2024 | 150 | 4 Week Post = 770 | |||||||
| 3/10/2024 | 190 | ||||||||
| 3/17/2024 | 250 | Then I would do a Change = divide(4 Week Post-4 Week Prior),4 Week Prior,0) | |||||||
| 3/24/2024 | 225 | ||||||||
| 3/31/2024 | 280 | ||||||||
| 4/7/2024 | 300 |
I was looking to make it where the date on comparison would be Week Ending 2-18-2024 as the actual price change date happened on 2-15-2024.
So even though we have data in this set into April, it would still calculate the expected results without having to change the date slicer to 3-17-24.
I appreciate your help.
MT