Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

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. 

  • Anonymous 

    Try it like this.

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

2 Replies

  • Anonymous 

    Try it like this.

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