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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

PowerBI CountRows IF Column Contains

I am trying count the number of rows in a table if a column CONTAINS certain text.... I have created a list of the items (13 items) which i need to check against the column to identify it it contains the data. 

 

For example:

 

Search Column1 to see if it CONTAINS "egg", "apple", rice"

 

and count the rows that return. 

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@Anonymous 

Try it like this.

Item Count =
CALCULATE (
    COUNTROWS ( YourTable ),
    'YourTable'[Column1] IN { "egg", "apple", "rice" }
)

View solution in original post

2 REPLIES 2
mh2587
Super User
Super User

=calculate (countrows(tablename), tablename[column] IN { "egg","apple","rice"})

 


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



jdbuchanan71
Super User
Super User

@Anonymous 

Try it like this.

Item Count =
CALCULATE (
    COUNTROWS ( YourTable ),
    'YourTable'[Column1] IN { "egg", "apple", "rice" }
)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.