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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
angelosales150
Frequent Visitor

Filter multiples variables in a single button

Good day, community!
I am looking for the solution to get the following type of filter buttons:
filter1: (altura > 175) && (peso > 70) && (categoria = 'vendedor')

filter2: ...

filter3: ...

filter4: ...

How can I link a button to give me range filter and subject filter together?

angelosales150_0-1674219452314.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @angelosales150 ,

Please try below steps:

1. below is my test table

Table:

vbinbinyumsft_0-1674442299630.png

Table2:

vbinbinyumsft_1-1674442314825.png

 

2. create a measure with below dax formula

Measure =
VAR cur_select =
    SELECTEDVALUE ( 'Table 2'[Filter] )
VAR _carros =
    SELECTEDVALUE ( 'Table'[carros] )
VAR _a =
    CALCULATETABLE (
        VALUES ( 'Table'[carros] ),
        FILTER (
            ALL ( 'Table' ),
            [altura] > 175
                && [peso] > 70
                && [categoria] = "vendedor"
        )
    )
VAR _b =
    CALCULATETABLE (
        VALUES ( 'Table'[carros] ),
        FILTER (
            ALL ( 'Table' ),
            [altura] > 175
                && [peso] > 70
                && [categoria] = "entregador"
        )
    )
VAR _c =
    CALCULATETABLE (
        VALUES ( 'Table'[carros] ),
        FILTER (
            ALL ( 'Table' ),
            [altura] > 170
                && [peso] > 70
                && [categoria] = "vendedor"
        )
    )
VAR _d =
    CALCULATETABLE (
        VALUES ( 'Table'[carros] ),
        FILTER (
            ALL ( 'Table' ),
            [altura] > 175
                && [peso] > 60
                && [categoria] = "vendedor"
        )
    )
VAR _val =
    SWITCH (
        cur_select,
        "filter1", IF ( _carros IN _a, 1 ),
        "filter2", IF ( _carros IN _b, 1 ),
        "filter3", IF ( _carros IN _c, 1 ),
        "filter4", IF ( _carros IN _d, 1 )
    )
RETURN
    IF ( ISFILTERED ( 'Table 2'[Filter] ), _val, 1 )

3. add a table visual with fields, add a slicer with field, apply this measure to table visual filter pane

vbinbinyumsft_2-1674442505383.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @angelosales150 ,

Please try below steps:

1. below is my test table

Table:

vbinbinyumsft_0-1674442299630.png

Table2:

vbinbinyumsft_1-1674442314825.png

 

2. create a measure with below dax formula

Measure =
VAR cur_select =
    SELECTEDVALUE ( 'Table 2'[Filter] )
VAR _carros =
    SELECTEDVALUE ( 'Table'[carros] )
VAR _a =
    CALCULATETABLE (
        VALUES ( 'Table'[carros] ),
        FILTER (
            ALL ( 'Table' ),
            [altura] > 175
                && [peso] > 70
                && [categoria] = "vendedor"
        )
    )
VAR _b =
    CALCULATETABLE (
        VALUES ( 'Table'[carros] ),
        FILTER (
            ALL ( 'Table' ),
            [altura] > 175
                && [peso] > 70
                && [categoria] = "entregador"
        )
    )
VAR _c =
    CALCULATETABLE (
        VALUES ( 'Table'[carros] ),
        FILTER (
            ALL ( 'Table' ),
            [altura] > 170
                && [peso] > 70
                && [categoria] = "vendedor"
        )
    )
VAR _d =
    CALCULATETABLE (
        VALUES ( 'Table'[carros] ),
        FILTER (
            ALL ( 'Table' ),
            [altura] > 175
                && [peso] > 60
                && [categoria] = "vendedor"
        )
    )
VAR _val =
    SWITCH (
        cur_select,
        "filter1", IF ( _carros IN _a, 1 ),
        "filter2", IF ( _carros IN _b, 1 ),
        "filter3", IF ( _carros IN _c, 1 ),
        "filter4", IF ( _carros IN _d, 1 )
    )
RETURN
    IF ( ISFILTERED ( 'Table 2'[Filter] ), _val, 1 )

3. add a table visual with fields, add a slicer with field, apply this measure to table visual filter pane

vbinbinyumsft_2-1674442505383.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for the answer, @Anonymous !
This code is really good and this way is way better for maintenance.

angelosales150
Frequent Visitor

Hi, @amitchandak.

I was looking for a solution with all the conditions in a unique line linked to a button to have a better maintenance. Just as when Q&A is used like "pessoa with peso > 40 & emprego = vendedor"

amitchandak
Super User
Super User

@angelosales150 , You need to create measures with slicers and use bookmarks and button

 

Bookmarks
https://radacad.com/bookmarks-and-buttons-making-power-bi-charts-even-more-interactive
https://docs.microsoft.com/en-us/power-bi/desktop-bookmarks

 

If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.