Forum Discussion

Kashuo's avatar
Kashuo
Icon for Helper I rankHelper I
9 years ago
Solved

How to filter a measure by multiple values

Hello, I would like to create a measure that returns the count of the rows of a table. I am able to use CALCULATE with a single value in the filter expression to get the measure to return the correct count of rows that contain that single value in that column. But I want to filter for not just one value, but for a handfull of values. Anyone know how to do this?

 

Here's a screenshot:

 

This successfully returns the number of rows with "Open" in the Stage column, but I want to return the number of rows that contain "Open", "Design" and others.

  • You can use double pipe || as a logical or

     

    =CALCULATE([measure], table[column 1] = 1 || table[column 1] = 2)

  • Or is a function that takes 2 parameters. Double pipe || is an inline syntax and you can have as many as you need. 

9 Replies

  • MattAllington's avatar
    MattAllington
    Icon for Community Champion rankCommunity Champion

    You can use double pipe || as a logical or

     

    =CALCULATE([measure], table[column 1] = 1 || table[column 1] = 2)

    • v-alhans's avatar
      v-alhans
      New Member

      When I use that formula, I get the error "The expression contains multiple columns, but only a single column ca be used in a True/False expression that is used as a table filter expression".

       

      My measure is: COUNTA('table[Column])

      • MattAllington's avatar
        MattAllington
        Icon for Community Champion rankCommunity Champion

        Or is a function that takes 2 parameters. Double pipe || is an inline syntax and you can have as many as you need. 

    • Anonymous's avatar
      Anonymous
      Not applicable

      what does [measure] mean in your example?

    • Kashuo's avatar
      Kashuo
      Icon for Helper I rankHelper I

      Matt gave it, above. I used "Doublepipe" ||