Forum Discussion

Asina's avatar
Asina
Icon for Helper III rankHelper III
4 years ago
Solved

Summation by two distinct categories

Hi

 

I have a table with the following values:

Category1             Category2                item                    Year        

A                              AA                            2                       2021

A                              AA                            2                       2021

B                              AA                            0                       2021

B                              AA                            0                       2021

C                              AA                            1                       2021

A                              BB                            5                       2021

A                              BB                            5                       2021

B                              BB                            1                       2021

B                              BB                            1                       2021

C                              BB                            3                       2021

...                               ....                             ...                     2022

...                               ....                             ...                     202x

 

I am looking for a way to summize amount of distinct items in Category2 based on Category1.. Example:

in Category2, we have AA, which contains A, A, B,B,C in Category1 and the following items of 2,2,0,0,1.

I want the result to be: 2+0+1 for AA or 5+1+3 for BB. 

 

thanks

  • Hi,

    I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

     

     

    expected outcome measure: =
    IF (
        HASONEVALUE ( Data[Category2] ),
        SUMX ( SUMMARIZE ( Data, Data[item] ), Data[item] )
    )
    

     

1 Reply

  • Hi,

    I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

     

     

    expected outcome measure: =
    IF (
        HASONEVALUE ( Data[Category2] ),
        SUMX ( SUMMARIZE ( Data, Data[item] ), Data[item] )
    )