Forum Discussion

New_Folder's avatar
New_Folder
Icon for Helper I rankHelper I
3 years ago
Solved

COUNTIFS with AND OR functions measure

TABLE_A,

COULMN_A <> CAT_1

COLUMN_B = CAT_2 or CAT_3

 

I want to create a measure where it counts the items the meets the criteria above. Where

Column A is not equal to Cat_1 

AND

Column B is equal to Cat_2 or Cat_3

 

Thanks! 

  • HI , New_Folder 

    Based on your requirement, I've created some sample data and write a measure to help you achieve the needs, please check the steps:


    This is my sample test data based on your requirement description:

    You can create a measure like this:

    Expected measure =
    COUNTROWS(FILTER(ALLSELECTED(Table_A),AND('Table_A'[Column A]<>'Table_A'[Cat_1],'Table_A'[Column B]='Table_A'[Cat_2]||'Table_A'[Column B]='Table_A'[Cat_3])))

    Then you can place it into a card chart like this:

     

     

    Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

     

    Best Regards,

    Aniya Zhang

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

1 Reply

  • HI , New_Folder 

    Based on your requirement, I've created some sample data and write a measure to help you achieve the needs, please check the steps:


    This is my sample test data based on your requirement description:

    You can create a measure like this:

    Expected measure =
    COUNTROWS(FILTER(ALLSELECTED(Table_A),AND('Table_A'[Column A]<>'Table_A'[Cat_1],'Table_A'[Column B]='Table_A'[Cat_2]||'Table_A'[Column B]='Table_A'[Cat_3])))

    Then you can place it into a card chart like this:

     

     

    Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

     

    Best Regards,

    Aniya Zhang

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