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
Anonymous
Not applicable

Filter a value based on multiple column or match on multiple columns

Hi there,

 

I'm looking how to achieve the below SQL. Appreciate any suggestion how to achieve the below.

--If filter value is B 

SELECT * FROM TABLE
WHERE COLUMN-1 = 'B' OR COLUMN-2 = 'B'

 

report link

https://github.com/ArtiAshu/dummy.git

 

AJAJ_1-1679329700193.png

 

Thanks.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

You can create a calcualted table which is separate.

Table 2 = DISTINCT('Table'[AllAirpots])

vstephenmsft_1-1679969343110.png

No relationship between tables.

vstephenmsft_0-1679969317345.png

Create a measure for visual level filters.

Measure =
VAR _sel =
    ALLSELECTED ( 'Table 2'[AllAirpots] )
RETURN
    IF (
        ISFILTERED ( 'Table 2'[AllAirpots] ),
        IF (
            MAX ( 'Table'[Destination] )
                IN _sel
                    || MAX ( 'Table'[Source] ) IN _sel,
            1
        ),
        1
    )

Put the measure into filters of the table visual. Set up show items when the value is 1.

vstephenmsft_2-1679969423770.png

The field of the slicer is from Table 2. When you select "B" in the slicer, the result is as follow.

vstephenmsft_3-1679969469892.png

 

                                                                                                                                                         

Best Regards,

Stephen Tao

 

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

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

 

You can create a calcualted table which is separate.

Table 2 = DISTINCT('Table'[AllAirpots])

vstephenmsft_1-1679969343110.png

No relationship between tables.

vstephenmsft_0-1679969317345.png

Create a measure for visual level filters.

Measure =
VAR _sel =
    ALLSELECTED ( 'Table 2'[AllAirpots] )
RETURN
    IF (
        ISFILTERED ( 'Table 2'[AllAirpots] ),
        IF (
            MAX ( 'Table'[Destination] )
                IN _sel
                    || MAX ( 'Table'[Source] ) IN _sel,
            1
        ),
        1
    )

Put the measure into filters of the table visual. Set up show items when the value is 1.

vstephenmsft_2-1679969423770.png

The field of the slicer is from Table 2. When you select "B" in the slicer, the result is as follow.

vstephenmsft_3-1679969469892.png

 

                                                                                                                                                         

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.           

 

Anonymous
Not applicable

@CNENFRNL Thank you very much. I'm afraid the table structure you had created is different from what my report table has. Per my current structure Source and Destination are 2 different columns of the same row. 

 

Is there anyway other way with the same sample table structure as above? i tried creating distinct of airport tables but still wondering how to get selectedvalue in source or destination and get all the rows.

 

Thank you.

CNENFRNL
Community Champion
Community Champion

CNENFRNL_1-1679342032467.png

 


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

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.