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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
lennox25
Post Patron
Post Patron

How to create a column filtering on two of the values.

I have a table. I need to create a column filtering on two of the values. - apples and pears.  Previously I only needed to filter on 1 so used the below to create a column.  Can it be adapted to cover the two values?

No of Apples = If('table'[Category] = "Apples", 1, 0)

lennox25_0-1702293134480.png

 

 

1 ACCEPTED SOLUTION
lukiz84
Memorable Member
Memorable Member

So you want a calculated column?

 

No of Apples and Pears := IF('table'[Category] IN {"Apples", "Pears"}, 1, 0)

View solution in original post

4 REPLIES 4
khaledHabib90
Resolver II
Resolver II

Hi lennox,

you have two options:

1- if you only need 2 values then use the below

No of Apples = If(OR('table'[Category] = "Apples",'table'[Category] = "Pears")10)

2- if you have more than 2

No of Apples = If('table'[Category] in { "Apples", "Pears","Anyother"} , 1, 0)

 

If my reply helped you solve the problem please accept it as the solution 🙂

Thank you - the more than two -that will help me in the future 🙂

lukiz84
Memorable Member
Memorable Member

So you want a calculated column?

 

No of Apples and Pears := IF('table'[Category] IN {"Apples", "Pears"}, 1, 0)

Perfect - Thank you!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

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.