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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
scottjl
Frequent Visitor

Filter multiple values from different columns

Hi,

 

I'm trying to filter my results where the value of column A is "yes" or the value of column B is "yes". Can someone help with the query?

 

Edit: It's a view back to a database and won't let me create a calculated column.  Is there another way to do this?

Thanks

 

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @scottjl ,

This is the data I created:

v-yangliu-msft_0-1621997040391.png

Here are the steps you can follow:

1. Create measure.

Measure =
IF(
    MAX('Table'[priority])="Yes"||MAX('Table'[resources])="Yes",1,0)

Result:

Now it shows that all data exist. Measure marks the unqualified data as 0 and the qualified data as 1

v-yangliu-msft_1-1621997040398.png

2. Put measure into filter, set is = 1, and apply filter

v-yangliu-msft_2-1621997040399.png

3. Result:

Display the data that meet the requirements:

v-yangliu-msft_3-1621997040403.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

9 REPLIES 9
v-yangliu-msft
Community Support
Community Support

Hi  @scottjl ,

This is the data I created:

v-yangliu-msft_0-1621997040391.png

Here are the steps you can follow:

1. Create measure.

Measure =
IF(
    MAX('Table'[priority])="Yes"||MAX('Table'[resources])="Yes",1,0)

Result:

Now it shows that all data exist. Measure marks the unqualified data as 0 and the qualified data as 1

v-yangliu-msft_1-1621997040398.png

2. Put measure into filter, set is = 1, and apply filter

v-yangliu-msft_2-1621997040399.png

3. Result:

Display the data that meet the requirements:

v-yangliu-msft_3-1621997040403.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Fowmy
Super User
Super User

@scottjl 

You can apply a filter as follows

FILTER ( 
   TABLE,
   TABLE[COLUMN A] = "YES" ||  TABLE[COLUMN B] = "YES"
)
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

scottjl
Frequent Visitor

Sorry, newbie question, where do I go in desktop to apply that filter?

@scottjl 

Can you explain what you are trying to acheive? Do you need a table as output or need to apply filtering inside a measure? Better provide some sample data and the expected results.

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

scottjl
Frequent Visitor

Sure. I have a gantt chart showing upcoming business opportunities that have a start and end date. The opportunity records in dynamics are all tagged priority "yes" or "no" and provide resources "yes" or "no". I want to only show the opportunities that are tagged priority "yes" or provide resources "yes". Priority and provide resources are 2 different columns in the table. 

@scottjl 

Basically, you will be having a measure to calculate a result that probably is used for conditional formatting based on the conditions you specified. you can incorporate the filter that I provided to apply the filter within your measure.

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

gdarakji
Resolver III
Resolver III

This is not possible from the filter pane. You might want to create a calculated column as OR([Column A]="yes",[Column B]="yes") and then filter on the calculated column

mahoneypat
Employee
Employee

Add a custom column with this expression and then filter the new column on "Y"

 

if [Column A] = "yes" or [Column B] = "yes" then "Y" else "N"

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Thanks Pat. It's a live database view so it won't let me add a new column. Can i do it with a measure?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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