Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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?
Solved! Go to Solution.
Hi @angelosales150 ,
Please try below steps:
1. below is my test table
Table:
Table2:
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
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.
Hi @angelosales150 ,
Please try below steps:
1. below is my test table
Table:
Table2:
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
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.
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"
@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.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 61 | |
| 43 | |
| 40 | |
| 38 | |
| 22 |
| User | Count |
|---|---|
| 178 | |
| 125 | |
| 116 | |
| 77 | |
| 54 |