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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Kashuo
Helper I
Helper I

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:

2017-02-07 20_52_30-Archive QC - Power BI Desktop.png

 

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.

2 ACCEPTED SOLUTIONS
MattAllington
Community Champion
Community Champion

You can use double pipe || as a logical or

 

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



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

View solution in original post

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



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

View solution in original post

9 REPLIES 9
SAG1
Helper I
Helper I

@Kashuo could you please share the solution , i have similar problem .

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

 

 

MattAllington
Community Champion
Community Champion

You can use double pipe || as a logical or

 

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



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.
Anonymous
Not applicable

what does [measure] mean in your example?

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])

That works, thank you!!

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



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Hello Matt,

 

Is there a way to use the || to sort byt two columns?

 

I have a total ranking of mutiple columns columns. However, I also have a column with the number of surveys the customer took. I need to rank all customers with more than 10 surveys in the upper half of my table but then I also need to rank those with less than 10 surveys in the lower half of the table. Any suggestion on how to do that?

 

Thank you,

 

Lukas

I'm not clear on what you mean by "rank".  If you need to filter a table based on the values in 2 different columns  

 

eg table[Col1] >=10 or table[Col2] <=10 then I would normally do this as follows

 

UNION(

filter(table,table[col1]>=10),

filter(table,table[col2]<=10)
)



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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