Forum Discussion
Pall
2 years agoRegular Visitor
How to calculate Cumulative Values when there are missing dates ?
Hi Sir, Using line graph to display cumulative values using below DAX. to handle missing dates and also have slicers to filter required sub_products. **bleep** Mat Sold = Var _cum =CALCULATE(...
- Anonymous2 years ago
Thanks for the reply from Ashish_Mathur and Uzi2019 , please allow me to provide another insight:
Hi Pall ,
Here are the steps you can follow:
1. Create calculated table.
Table 2 = DISTINCT('Table'[Sub_Prod])2. Create measure.
Sales_Measure = var _select=SELECTCOLUMNS('Table 2',"test",'Table 2'[Sub_Prod]) return IF( MAX('Table'[Sub_Prod]) in _select,SUM('Table'[Sales]),0)If you want to do all accumulation based on the slicer selection, you can use the following measure
Cumulative Sales = SUMX( FILTER(ALL('Table'), 'Table'[Date]<=MAX('Table'[Date])),[Sales_Measure])If you want to do year and month grouping accumulation based on the slicer selection, you can use the following measure
Cumulative Sales Group = SUMX( FILTER(ALL('Table'), YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&MONTH('Table'[Date])=MONTH(MAX('Table'[Date]))&&'Table'[Date]<=MAX('Table'[Date])),[Sales_Measure])3. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Ashish_Mathur
Super User
2 years agoHi,
PBI file attached.
Hope this helps.
Pall
2 years agoRegular Visitor
Thanks for the quick respond. but actually in the above case also, there is missing dates with Feb.