cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
peterg417 Frequent Visitor
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

Accepted Solutions
kcantor Super Contributor
Super Contributor

Re: Filtering between 2 different items

@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 Datanaut!




View solution in original post

3 REPLIES 3
kcantor Super Contributor
Super Contributor

Re: Filtering between 2 different items

@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 Datanaut!




View solution in original post

Microsoft v-huizhn-msft
Microsoft

Re: Filtering between 2 different items

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

 

 

 

peterg417 Frequent Visitor
Frequent Visitor

Re: Filtering between 2 different items

Thanks guys! That's perfect!

Helpful resources

Announcements
New Kudos Received Badges Coming

New Kudos Received Badges Coming

Kudos to you if you earned one of these! Check your inbox for a notification.

Microsoft Implementation for Communities Wins Award

Microsoft Implementation for Communities Wins Award

Learn about the award-winning innovation that was implemented across Microsoft’s Business Applications Communities.

Power Platform World Tour

Power Platform World Tour

Find out where you can attend!

Top Kudoed Authors (Last 30 Days)
Users online (1,972)