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! Request now

Reply
Anonymous
Not applicable

Filter Table based on multiple True/False columns

Hi all,

 

I am trying to create a filter table Z that manages four boolean columns in another table X. For example, if the filter is set to "A", then it filters out all the FALSE statements in column "A" in Table X. How can I approach this without using an unpivot on my table X?

 

Filter Table Z

A
B
C
D

 

Table X

IDABCD
1TRUEFALSETRUEFALSE
2TRUEFALSETRUETRUE
3FALSEFALSETRUEFALSE
4FALSEFALSETRUETRUE
5TRUETRUETRUEFALSE
6FALSETRUEFALSETRUE
7FALSEFALSEFALSEFALSE
8TRUETRUEFALSETRUE
9FALSEFALSEFALSEFALSE
10FALSETRUEFALSETRUE
11FALSEFALSEFALSETRUE
12TRUETRUEFALSEFALSE
13FALSEFALSETRUEFALSE
14TRUETRUETRUEFALSE
15FALSEFALSEFALSEFALSE
16TRUETRUETRUEFALSE
17TRUEFALSEFALSETRUE
18TRUETRUEFALSETRUE
19TRUETRUEFALSEFALSE
20TRUEFALSETRUEFALSE

 

Filter Table Z set to A

A

 

Table X filtered based on column A being TRUE

IDABCD
1TRUEFALSETRUEFALSE
2TRUEFALSETRUETRUE
5TRUETRUETRUEFALSE
8TRUETRUEFALSETRUE
12TRUETRUEFALSEFALSE
14TRUETRUETRUEFALSE
16TRUETRUETRUEFALSE
17TRUEFALSEFALSETRUE
18TRUETRUEFALSETRUE
19TRUETRUEFALSEFALSE
20TRUEFALSETRUEFALSE

 

Many thanks,

Jason

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@Anonymous add a measure in your table as below:

 

What to Filter? = 
VAR __filter = SELECTEDVALUE( 'Filter Table'[Filter] )
VAR __Isfilter =  
    SWITCH(
        __filter,
        "A", SELECTEDVALUE( table3[A] ) = TRUE(),
        "B", SELECTEDVALUE( table3[B] ) = TRUE(),
        "C", SELECTEDVALUE( table3[C] ) = TRUE(),
        "D", SELECTEDVALUE( table3[D] ) = TRUE()
    )
    RETURN IF( __Isfilter = TRUE(), 1, 0 )

on your table visual, add visual level filter and select "What to filter?" is 1  as shown below and based on your selection in slicer, it will filter table accordingly

 

image.png



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

4 REPLIES 4
parry2k
Super User
Super User

@Anonymous add a measure in your table as below:

 

What to Filter? = 
VAR __filter = SELECTEDVALUE( 'Filter Table'[Filter] )
VAR __Isfilter =  
    SWITCH(
        __filter,
        "A", SELECTEDVALUE( table3[A] ) = TRUE(),
        "B", SELECTEDVALUE( table3[B] ) = TRUE(),
        "C", SELECTEDVALUE( table3[C] ) = TRUE(),
        "D", SELECTEDVALUE( table3[D] ) = TRUE()
    )
    RETURN IF( __Isfilter = TRUE(), 1, 0 )

on your table visual, add visual level filter and select "What to filter?" is 1  as shown below and based on your selection in slicer, it will filter table accordingly

 

image.png



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Thanks @parry2k !

 

I took your example and reduced it (to see if I actually understood your work). I'm new to DAX, so I am not sure if there is a best practice for writing DAX. This is how I reduced it:

 

 
What is Filter? 3 = IF( 
    SWITCH(
        SELECTEDVALUE( 'Filter Table'[Filter] ),
        "A", SELECTEDVALUE( table3[A] ),
        "B", SELECTEDVALUE( table3[B] ),
        "C", SELECTEDVALUE( table3[C] ),
        "D", SELECTEDVALUE( table3[D] )
    ) = TRUE(), 1, 0)

 

1. Why do we need the '= TRUE()' statement after the SELECTEDVALUE('table3'[A]) statement?

2. Is it best practice to define statements in separate VARs?

3. Is it best practice to use RETURNIF vs. wrapping the whole statement in an IF statement?

@Anonymous your dax expression is also good but best practice and experts recommend to break it into pieces, it is much easier to debug, easy to read and easy to make the changes in future if someone else is looking at the expression.

 

Again your expression would work but bit difficult to ready at first go. 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Thanks @parry2k !

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.

Top Solution Authors
Top Kudoed Authors