Forum Discussion

tzuchiao's avatar
tzuchiao
Regular Visitor
1 year ago
Solved

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 (Consiste...
  • danextian's avatar
    1 year ago

    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.

    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]
            )
        )
    )