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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Filter table data based on Slicer selection

Hello ,

 

I have a question on applying filter based on Slicer selection. I am using direct connection to connect a database.

 

Q : we have Slicer Table as an example which will display in power BI Slicer.

 

Slicer Header

--------------

Status  1

Status  2

Status 3

 

And I have a main data table with actual dimentions and measures . I am displying this data in a table and Column chart is Power BI.

ID      Quantity  Status1  Status2  Status3

100    12.2         Y             N           N

101    9.6           N            Y            Y

102    10.3         N           Y             N

104     19           N          N             N

105    18            Y           Y              N

 

If Slicer selection is "Status 1" I want to apply filter as Sttaus1=Y, elseif "Staus2" then Status2=N,elsefif "Status 3" then Status3="Y"

 

And I have to use this filter on Table and Bar chart visuals . I cannot create any relation between these two tables .

 

Can you post solution if we have any in Power BI.

 

Thanks in advance!

SS

 

 

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

You can create the following measure and use it as a filter on the visual. Set it to show items when the value is 1. If you don't select any status, it will show all. 

 

Filter Flag = 
SWITCH(SELECTEDVALUE(Slicer[Status]),
"Status 1",IF(SELECTEDVALUE('Table (2)'[Status1])="Y",1,0),
"Status 2",IF(SELECTEDVALUE('Table (2)'[Status2])="Y",1,0),
"Status 3",IF(SELECTEDVALUE('Table (2)'[Status3])="Y",1,0),
1)

 

vjingzhang_0-1658302403523.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

3 REPLIES 3
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

You can create the following measure and use it as a filter on the visual. Set it to show items when the value is 1. If you don't select any status, it will show all. 

 

Filter Flag = 
SWITCH(SELECTEDVALUE(Slicer[Status]),
"Status 1",IF(SELECTEDVALUE('Table (2)'[Status1])="Y",1,0),
"Status 2",IF(SELECTEDVALUE('Table (2)'[Status2])="Y",1,0),
"Status 3",IF(SELECTEDVALUE('Table (2)'[Status3])="Y",1,0),
1)

 

vjingzhang_0-1658302403523.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

amitchandak
Super User
Super User

@Anonymous , Try like

 

var _filter = Switch(Selectedvalue(Status[Status]),
"Status1" , filter(Table, Table[Status1] = "Y"),
"Status2" , filter(Table, Table[Status2] = "Y"),
"Status3" , filter(Table, Table[Status3] = "Y") )
return
calculate( countrows(Table), _filter)

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
tamerj1
Super User
Super User

Hi @Anonymous 

are Status 1, 2 & 3 columns in your source data or attributes of one column? Is the slicer table connected with main table using a relationship?

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.