Forum Discussion

jyaul786's avatar
jyaul786
Helper II
2 years ago
Solved

Sum

Dear friend, i have data like:  Category Sub category value A A1 5 A A1 10 A A2 3 B B1 6 B B1 3 C C1 4 C C2 -10 C C3 5   i created measuer: result=...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi jyaul786 ,

     

    I suggest you to try code as below to create a calculated column.

    Result = 
    VAR CategoryA =
    SUMX (
    FILTER ( 'Table', 'Table'[Category] in {"A","C"} ),
    'Table'[value]
    )
    RETURN
    IF ( [Category] = "A", CategoryA, 0 )

    Result is as below.

     

    Best Regards,
    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.