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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Kudoed Authors