Forum Discussion
Week-To-Date Cumulative Not Resetting Properly
- 1 year ago
Hello sandy_liew ,
You can use windows function with Partition By clause to get this result. Here is the dax for your reference.
Week_Cumm =
CALCULATE (
SUM ( Test_Table[Total_DRR] ),
WINDOW (
0,
ABS,
0,
REL,
ALL ( Test_Table[Finance_Date], Test_Table[Week_1] ),
ORDERBY ( Test_Table[Finance_Date] ),
,
PARTITIONBY ( Test_Table[Week_1] )
)
)I hope this helps.
Warm Regards,
Neeraj
- 1 year ago
Thank you divyed , it worked perfectly!!
Hi, I currently have another DAX logic formula as shown below for Month-to-Date (MTD) cumulative, however it is facing the issue of not following the 202410 month as shown in the "Month" column, supposedly it should not reset on 10/1/2024 but rather it should still continue the cumulation until the "Month" column turn into 202411 in order to reset the MTD calculation
divyed I tried using your DAX logic formula and change it to partition according to month for Month-To-Date (MTD) cumulative, however it shows the same result as the one you showed me for Week-To-Date (WTD) cumulative, but when I removed the "WW" column, everything will be normal, the thing is it is compulsory for me to show the "WW" column
- divyed1 year agoSuper User
Hello sandy_liew ,
Could you please share your dax to check further ?
Please note couple of things in the formula shared:
1. ALL ( Test_Table[Finance_Date], Test_Table[Week_1] )
you need to add fields here , you should use of relaive fields used in dax either in partition by
or order by.
2. PARTITIONBY ( Test_Table[Week_1] )
you can pass multiple fields in correct sequence to get desired result.
I hope this helps.
Warm Regards,
Neeraj