Forum Discussion
sneevand
5 years agoFrequent Visitor
Cumulative total by category -Measure
Raw data
| Date | amount | product |
| 01-01-2020 | 10 | Product1 |
| 01-02-2020 | 12 | Product2 |
| 01-03-2020 | 10 | Product1 |
| 01-04-2020 | 13 | Product2 |
| 01-05-2020 | 15 | product2 |
| 01-06-2020 | 10 | product1 |
| 70 |
Expected data:
| Date | amount | product | totalbyproduct |
| 01-01-2020 | 10 | Product1 | 30 |
| 01-02-2020 | 12 | Product2 | 40 |
| 01-03-2020 | 10 | Product1 | 30 |
| 01-04-2020 | 13 | Product2 | 40 |
| 01-05-2020 | 15 | product2 | 40 |
| 01-06-2020 | 10 | product1 | 30 |
| 70 |
Does this work for your context?
Sum by Product: = CALCULATE( SUM('Table'[amount]), ALLEXCEPT('Table', 'Table'[product]) ) //Removes filter context from the table except for productResult:
https://docs.microsoft.com/en-us/dax/allexcept-function-dax
If this works for you then please select as Answer. All likes and Kudos appreciated.
1 Reply
- Carmichael
Advocate III
Does this work for your context?
Sum by Product: = CALCULATE( SUM('Table'[amount]), ALLEXCEPT('Table', 'Table'[product]) ) //Removes filter context from the table except for productResult:
https://docs.microsoft.com/en-us/dax/allexcept-function-dax
If this works for you then please select as Answer. All likes and Kudos appreciated.