Forum Discussion
Anonymous
5 years agoNot applicable
Category wise calculation using a measure
I have 8 categories in my data, I want to calculate a percentage value or a metric
If the user belongs to categories 1,3,2,8 then I want a formula to apply to them, lets call it as formula a - sum[a+b+c+d]
If the user belongs to categories 4,5,6,7 then I want a formula to apply to them, lets call it as formula b -sum [a*10+d*10+e*10]
How to achieve this?
Please try this measure :
Measure = SWITCH(TRUE(), MAX('Table'[Category ]) in {1,3,2,8},SUM('Table'[a])+SUM('Table'[b])+SUM('Table'[c])+SUM('Table'[d]), MAX('Table'[Category ]) in {4,5,6,7},(SUM('Table'[a])+SUM('Table'[d])+SUM('Table'[e]))*10)
4 Replies
- Fowmy
Super User
Anonymous
You can use this pattern:Measure = CALCULATE( SUM(Table[Value]), Table[user] IN {1,3,2,} ) - V-lianl-msft
Community Support
Please try this measure :
Measure = SWITCH(TRUE(), MAX('Table'[Category ]) in {1,3,2,8},SUM('Table'[a])+SUM('Table'[b])+SUM('Table'[c])+SUM('Table'[d]), MAX('Table'[Category ]) in {4,5,6,7},(SUM('Table'[a])+SUM('Table'[d])+SUM('Table'[e]))*10)