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
Highlighted
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
Highlighted
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

v-huizhn-msft Super Contributor
Super Contributor

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
Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 141 members 1,714 guests
Please welcome our newest community members: