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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.