Forum Discussion
Calculation that need to filter based on different category
Need help on this:
| Jobs | Units |
| A | 10 |
| B | 20 |
| C | 30 |
| D | 0 |
Expected Output:
| Jobs | New Units |
| A | 10 |
| B | 20 |
| C | 30 |
| D | Jobs A + B + C |
Hi, Anonymous
Please try the below measure.
New Units Measure =
SUMX (
VALUES ( 'Table'[Jobs] ),
CALCULATE (
SWITCH (
SELECTEDVALUE ( 'Table'[Jobs] ),
"D", CALCULATE ( SUM ( 'Table'[Units] ), 'Table'[Jobs] IN { "A", "B", "C" } ),
SUM ( 'Table'[Units] )
)
)
)Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Linkedin: linkedin.com/in/jihwankim1975/
Twitter: twitter.com/Jihwan_JHKIM
1 Reply
- Jihwan_Kim
Super User
Hi, Anonymous
Please try the below measure.
New Units Measure =
SUMX (
VALUES ( 'Table'[Jobs] ),
CALCULATE (
SWITCH (
SELECTEDVALUE ( 'Table'[Jobs] ),
"D", CALCULATE ( SUM ( 'Table'[Units] ), 'Table'[Jobs] IN { "A", "B", "C" } ),
SUM ( 'Table'[Units] )
)
)
)Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Linkedin: linkedin.com/in/jihwankim1975/
Twitter: twitter.com/Jihwan_JHKIM