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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
tavolo89
Frequent Visitor

Visual filter not actually filtering out values from a measure

I am trying to use the method outlined in this video from BI Elite to slice on a measure value.

 

https://www.youtube.com/watch?v=AHiCE1N0XHE

 

As you can see, the slicer value provided is "80-90" and the value returned from my measure "Ranking_Views_Banding" is "80-90%".

 

 

tavolo89_0-1679933632176.png

 

The second column "Filter - View Bands" is a DAX measure:

 

Filter - View Bands =

VAR CurrentSelection = SELECTEDVALUE('Slice by - View Bands'[View Band])
Var CurrentBand = [Ranking_Views_Banding]

RETURN
IF(CurrentSelection = CurrentBand, "Yes", "No")
 
So far, so good. However, when I try and filter on the visual to only include "Yes" values from the "Filter - View Bands" measure it still includes the "No" values. I've tried using a switch statement, and using boolean values instead of text. The result is always the same.
 
It feels like the visual filter is evaluating in a different context perhaps? But I have no idea how to proceed. I would be very grateful if someone can help me understand this.
3 REPLIES 3
johnt75
Super User
Super User

Use Performance Analyzer to get the DAX code for the table visual and paste it into DAX Studio. There will be a variable with ValueFilter in the name, where it will likely be wrapping a SUMMARIZECOLUMNS inside a FILTER checking that the value of your filter view brands measure is Yes. Take that inner SUMMARIZECOLUMNS and evaluate it, that should give a better understanding of what is going on.

Thank you. This is the DAX query (with a couple of fields changed to stay anonymous!). I notice that if I evaluate __ValueFilterDM1 then I get the result I'm expecting - i.e. filtered for "Yes" on the "Filter - View Bands" measure.

 

How can I make PBI apply the same filter to the __DS0PrimaryWindowed variable?

// DAX Query
DEFINE
    VAR __DS0FilterTable = 
        TREATAS({"YTD"}, 'Period A'[Is_YTD])

    VAR __DS0FilterTable2 = 
        TREATAS({"LW-1"}, 'Period B'[Is_LW-1])

    VAR __DS0FilterTable3 = 
        TREATAS({"Filter1"}, 'dim Product'[myAttributeFilter])

    VAR __DS0FilterTable4 = 
        TREATAS({"90-100%"}, 'Slice by - View Bands'[View Band])

    VAR __ValueFilterDM1 = 
        FILTER(
            KEEPFILTERS(
                SUMMARIZECOLUMNS(
                    'dim Product'[Item ID],
                    'Slice by - View Bands'[View Band],
                    'dim Product'[myAttribute1],
                    __DS0FilterTable,
                    __DS0FilterTable2,
                    __DS0FilterTable3,
                    __DS0FilterTable4,
                    "Ranking_Views_Banding", 'Web Detail'[Ranking_Views_Banding],
                    "v_Ranking_Views_Banding_FormatString", IGNORE('Web Detail'[_Ranking_Views_Banding FormatString]),
                    "Filter___View_Bands", 'Web Detail'[Filter - View Bands],
                    "v_Filter___View_Bands_FormatString", IGNORE('Web Detail'[_Filter - View Bands FormatString]),
                    "Ranking_Views_Percentile", 'Web Detail'[Ranking_Views_Percentile],
                    "v_Ranking_Views_Percentile_FormatString", IGNORE('Web Detail'[_Ranking_Views_Percentile FormatString]),
                    "v__Product_Views", 'Web Detail'[# Product Views],
                    "v___Product_Views_FormatString", IGNORE('Web Detail'[_# Product Views FormatString])
                )
            ),
            [Filter___View_Bands] = "Yes"
        )

    VAR __DS0Core = 
        SUMMARIZECOLUMNS(
            ROLLUPADDISSUBTOTAL(
                ROLLUPGROUP(
                    'dim Product'[Item ID],
                    'Slice by - View Bands'[View Band],
                    'dim Product'[myAttribute1]
                ), "IsGrandTotalRowTotal"
            ),
            __DS0FilterTable,
            __DS0FilterTable2,
            __DS0FilterTable3,
            __DS0FilterTable4,
            __ValueFilterDM1,
            "v__Product_Views", 'Web Detail'[# Product Views],
            "Ranking_Views_Banding", 'Web Detail'[Ranking_Views_Banding],
            "v_Ranking_Views_Banding_FormatString", IGNORE('Web Detail'[_Ranking_Views_Banding FormatString]),
            "Filter___View_Bands", 'Web Detail'[Filter - View Bands],
            "v_Filter___View_Bands_FormatString", IGNORE('Web Detail'[_Filter - View Bands FormatString]),
            "Ranking_Views_Percentile", 'Web Detail'[Ranking_Views_Percentile],
            "v_Ranking_Views_Percentile_FormatString", IGNORE('Web Detail'[_Ranking_Views_Percentile FormatString]),
            "v___Product_Views_FormatString", IGNORE('Web Detail'[_# Product Views FormatString])
        )

    VAR __DS0PrimaryWindowed = 
        TOPN(
            502,
            __DS0Core,
            [IsGrandTotalRowTotal],
            0,
            [v__Product_Views],
            0,
            'dim Product'[Item ID],
            1,
            'Slice by - View Bands'[View Band],
            1,
            'dim Product'[myAttribute1],
            1
        )

EVALUATE
__DS0PrimaryWindowed
//__ValueFilterDM1

ORDER BY
    //[IsGrandTotalRowTotal] DESC,
    [v__Product_Views] DESC,
    'dim Product'[Item ID],
    'Slice by - View Bands'[View Band],
    'dim Product'[myAttribute1]

Bit of a shot in the dark but can you try commenting out __DS0Filter3 from both __ValueFilterDM1 and __DS0Core? I just wonder if the filter on the product table is interfering somehow.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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