Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
New_Folder
Helper I
Helper I

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! 

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

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:

vyueyunzhmsft_0-1688350317762.png

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:

vyueyunzhmsft_1-1688350354272.png

 

 

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

View solution in original post

1 REPLY 1
v-yueyunzh-msft
Community Support
Community Support

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:

vyueyunzhmsft_0-1688350317762.png

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:

vyueyunzhmsft_1-1688350354272.png

 

 

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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.