Forum Discussion
Dynamically Calculate Sums Per Category in Measure
- 2 years ago
I'm confused. Are you sure you are not overthinking this?
Did you have a look at the [Sales Amount] measure example and apply it to your use case?
If you did, can you show me what the results are and why it's not suitable?
iterator functions. SUMX unless I am misunderstanding the requirement.
HotChilli
Hello!
Could you please expand on that? Even if I iterate through each row, at the end of the day the full sum of the user category is 1. I don't know how to split the calculation into chunks based on the category without filtering each value manually:
Offhand, pardon syntax -
SUMX(FILTER(table, Category = "A"), User Category * Data Category) +
SUMX(FILTER(table, Category = "B"), User Category * Data Category) +
SUMX(FILTER(table, Category = "C"), User Category * Data Category)
I want it to be dynamic, so this can be done in one calculation that will be affected by slicers on the category column instead of hardcoded A, B, C.