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
peterg417
Frequent Visitor

Filtering between 2 different items

I'm still fairly new to this Power BI thing, but I am trying to get information to display from our database based on these filters:

 

Estimated Sale Price >= $1,000,000

OR

Estimated Value >= $80,000

 

In "Report Level Filters", where I drop in those to fields ("Estimated Sale Price" and "Estimated Value"), and I add those parameters, it's treated as an AND filter, so the data must meet both of those criteria. I just want one or the other.

 

How would I do this?

 

Thanks

1 ACCEPTED SOLUTION
kcantor
Community Champion
Community Champion

@peterg417

You could do this in query editor to set a flag using an if statement then use that flag for your page level filter.

since I don't know your field names for certain I will use what you have provided.

In Query editor, add a custom column with a unique name.

it should be:

if [Estimated Sale Price] >= 1,000,000 then 1 else if [Estimated Value] >= 80,000 then 1 else 0

depending on your data of course. This will add a column populated with 1s and 0s that can be used as filter flags for your "or" statement.

Add it as a page filter then select 1 to filter the results.  May not be elegant but it should work.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
v-huizhn-msft
Employee
Employee

Hi @peterg417,

The solution @kcantor posted is a perfect one. If you only want to get the data from one table. For example, you get data from SQL Server database, you can filter your resouce table using SQL statement. Type the similar SQL satement below to the window highlighted in blue line.

 

SELECT * FROM Table WHERE Table.Estimated Sale Price >= $1,000,000 OR Table.Estimated Value >= $80,000



1.PNG

Different from the one @kcantor posted. In your Power BI desktop data model, there are only rows where Estimated Sale Price >= $1,000,000 OR Estimated Value >= $80,000. Other rows are not unloaded in the model.

Best Regards,
Angelia

 

 

 

Thanks guys! That's perfect!

kcantor
Community Champion
Community Champion

@peterg417

You could do this in query editor to set a flag using an if statement then use that flag for your page level filter.

since I don't know your field names for certain I will use what you have provided.

In Query editor, add a custom column with a unique name.

it should be:

if [Estimated Sale Price] >= 1,000,000 then 1 else if [Estimated Value] >= 80,000 then 1 else 0

depending on your data of course. This will add a column populated with 1s and 0s that can be used as filter flags for your "or" statement.

Add it as a page filter then select 1 to filter the results.  May not be elegant but it should work.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.