Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Calculation that need to filter based on different category

Need help on this: 

 

JobsUnits
A10
B20
C30
D0

 

Expected Output:

JobsNew Units
A10
B20
C30
DJobs 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

  • 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