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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
tzuchiao
Regular Visitor

Filtering with an OR condition and user-defined thresholds

Hello community,

 

I have a dataset like this:
ID, Consistent, Deviation.

I want to remove rows where Consistent < 15 and Deviation > 90, which is easy with a new column:
is_bad = if (Consistent < 15 AND Deviation > 90, True(), False()), then have a filter that keep only is_bad = False().

However, I want the user of the dashboard to be able to change the 15 and 90 values.
I cannot use two filters to keep Consistent >= 15 AND Deviation <= 90, because I want
Consistent >= 15 OR Deviation <= 90.
I also cannot use the calculated column as before since it does not respond to parameters. 
What should I do?

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @tzuchiao 

You can use what-if parameters as the values to feed to the filter. You can modify its calcualted table formula to reference the max consistent/deviation value so the series of numbers becomes dynamic. This feature generates a series of numbers and which slicer allows for a single value selection using a slider. Please see the attached sample pbix.

danextian_0-1736660909136.png

You can then use a measure to visually filter your table using an OR logic.

Consistent Deviation Filter = 
// This measure calculates the count of rows in 'Table' based on a filter condition.
CALCULATE (
    COUNTROWS ( 'Table' ),
    // Counts the rows in 'Table'
    KEEPFILTERS (
        FILTER (
            // Applies a filter on 'Table'[Consistent] and 'Table'[Deviation] columns
            ALL (
                'Table'[Consistent],
                'Table'[Deviation]
            ),
            // Filters rows where 'Consistent' is greater than or equal to [ConsistentFilter Value]
            // OR 'Deviation' is less than or equal to [DeviationFilter Value]
            'Table'[Consistent] >= [ConsistentFilter Value]
                || 'Table'[Deviation] <= [DeviationFilter Value]
        )
    )
)

 

danextian_1-1736661012754.png

 










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


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

3 REPLIES 3
danextian
Super User
Super User

Hi @tzuchiao 

You can use what-if parameters as the values to feed to the filter. You can modify its calcualted table formula to reference the max consistent/deviation value so the series of numbers becomes dynamic. This feature generates a series of numbers and which slicer allows for a single value selection using a slider. Please see the attached sample pbix.

danextian_0-1736660909136.png

You can then use a measure to visually filter your table using an OR logic.

Consistent Deviation Filter = 
// This measure calculates the count of rows in 'Table' based on a filter condition.
CALCULATE (
    COUNTROWS ( 'Table' ),
    // Counts the rows in 'Table'
    KEEPFILTERS (
        FILTER (
            // Applies a filter on 'Table'[Consistent] and 'Table'[Deviation] columns
            ALL (
                'Table'[Consistent],
                'Table'[Deviation]
            ),
            // Filters rows where 'Consistent' is greater than or equal to [ConsistentFilter Value]
            // OR 'Deviation' is less than or equal to [DeviationFilter Value]
            'Table'[Consistent] >= [ConsistentFilter Value]
                || 'Table'[Deviation] <= [DeviationFilter Value]
        )
    )
)

 

danextian_1-1736661012754.png

 










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


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file and show the expected result there.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@tzuchiao , You have pust this a measures whenever you need 

 

example

Sumx(filter( Table, [Consistent] >= 15 OR [Deviation] <= 90), Table[Value])

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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