Forum Discussion
weekly running total
- Anonymous2 years ago
Hi ahmoh43
Thanks for the solution MFelix provided, and i want to offer some information for you to refer to.
Sample data
Create a measure.
MEASURE = CALCULATE ( SUM ( 'Table'[Value] ), ALLSELECTED ( 'Table' ), 'Table'[WeekNo] <= MAX ( 'Table'[WeekNo] ) )Then put the the measure to the y-axis.
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi ahmoh43,
For this you need to create a cummulative measure that will allow to have the calculation for each week.
You can do a measure similar to this one:
Weekly Cumulative = CALCULATE (SUM(Table[Column]), Table[Week] >= MAX(Table[Week]))
Be aware that I'm assuming that you are only selecting a specific year for the visualization of the chart.
- SteffanieJ1 year agoFrequent Visitor
Hi MFelix - What if I wanted to do something similar comparing 2023-2024 by week but for the last 2 quarteres of the year? Can you add a filter for year as well?
- MFelix1 year agoSuper User
Hi SteffanieJ ,
Yes you can do that depending on the result you want to achieve you can add additional filter to the calculation to get the previous year values.
Depending on how you have the setup of your model you can do it using the DATEADD syntax for example or SAMEPERIODLASTYEAR or forcing the year to be equal to MAX(Year) - 1
- SteffanieJ1 year agoFrequent Visitor
MFelix - I have the date add formula in the 2023 and 2024 columns. Here are the formulas used last year but when I change them to -2 and -1 year and then change my created year to 2025 the running total column goes blank.
OD SO 2023 = CALCULATE([SO Total Sales Shipped/Open],DATEADD('EB Orders'[SO CrtnDate].[Date],-1,year))OD SO 2024 = CALCULATE([SO Total Sales Shipped/Open],DATEADD('EB Orders'[SO CrtnDate].[Date],-0,year))YOY Formula -OD SO Week Diff 2023-2024 = CALCULATE([OD SO 2024]-'EB Orders'[OD SO 2023])Running total formula -OD SO Week Diff running total in Week 2023-2024 =CALCULATE([OD SO Week Diff 2023-2024],FILTER(ALLSELECTED('EB Orders'[Created On Week]),ISONORAFTER('EB Orders'[Created On Week], MAX('EB Orders'[Created On Week]), DESC)))