Forum Discussion
Abdel
2 years agoRegular Visitor
Cumulative sum
I have a dataset contains 52 week of sales : the table below is a sample of the dataset I have. Week Sales Actual/forecast 1 10 Actual 1 12 Forecast ...
- 2 years ago
Add this measure or club: I still not understand the intention ...
Sales for Actual = CALCULATE( SUM('salesdata'[Sales ]), 'salesdata'[Actual/forecast] IN { "Actual" } ) Sales for Forecast = CALCULATE( SUM('salesdata'[Sales ]), 'salesdata'[Actual/forecast] IN { "Forecast" } ) CT Actual or Forecast = SUMX ( CALCULATETABLE( values(salesdata[Week ]), salesdata[Week ] <= MAX(salesdata[Week ])) , COALESCE( salesdata[Sales for Actual], [Sales for Forecast]) )If you dont want multiple measures, you can club the measure logic into one measure!
Hoep this helps!
- 2 years ago
I do NOT see any issue.
Check these screenshots:
a) No selection
b) with selection of Week 2, week 2
b) with selection of Week 1, Week 4
sevenhills
2 years agoSuper User
U have to share the DAX or .pbix for us to understand. 🙂
if u r trying to filter the range of weeks as min and max , you may need to tweak this line as:
CALCULATETABLE( values(salesdata[Week ]),
salesdata[Week ] >= MIN(salesdata[Week ] && salesdata[Week ] <= MAX(salesdata[Week ]
)
Abdel
2 years agoRegular Visitor
This is exactly what I did but it does not work I think it's because the data type of my week column. So basically my column contains numbers (1,2,3,4) and the data type is whole decimal number; that's the only reason I think why this formula isn't working for me