Forum Discussion
Cumulative sum
- 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
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!
Hi I have a question please - I have created two variables minweek and max week and used your formula and added min week so when I select for example week 3 and 6 I want to sum the actuals from week 3 to week 6 and not from week 1 to week 6 but it does not work for some reason
- sevenhills2 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 ] )- Abdel2 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