Forum Discussion

sabeensp's avatar
sabeensp
Icon for Helper IV rankHelper IV
7 years ago
Solved

Filter based on another field in teh same table

Hello,

 

 I ahve a table T! with teh following fields

 

ID -- Location -- Cust -- Status-- CUST_ACCT

1 -- CA -- John -- Active --12

2 -- TX -- Jerry -- InActive -- 2

3 -- NY -- Jedd -- Active -- 3

4 -- CA -- Zac -- Active -- 18

I need to create a grid in Power BI, based on follwing SQL Query, that I have, basically converting my SQL Statrement to DAX

Select ID, Location, Cust , Status

FROM T1

Where Location like 'C%'

and

CUST_ID <> CUST_ACCT

 

Thanks in advance.

  • Hi sabeensp ,

    For your requirement, you could create the calculated column with the dax below.

    Table =
    FILTER (
        'Table_T',
        'Table_T'[CUST_ACCT] <> 'Table_T'[ID]
            && SEARCH ( "C", 'Table_T'[Location], 1, 0 )
    )
    

    Here is the output.

    Best Regards,

    Cherry

     

3 Replies

  • v-piga-msft's avatar
    v-piga-msft
    Icon for Resident Rockstar rankResident Rockstar

    Hi sabeensp ,

    For your requirement, you could create the calculated column with the dax below.

    Table =
    FILTER (
        'Table_T',
        'Table_T'[CUST_ACCT] <> 'Table_T'[ID]
            && SEARCH ( "C", 'Table_T'[Location], 1, 0 )
    )
    

    Here is the output.

    Best Regards,

    Cherry

     

  • v-piga-msft's avatar
    v-piga-msft
    Icon for Resident Rockstar rankResident Rockstar

    Hi sabeensp ,

    Have you solved your problem?

    If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

    If you still need help, please share your desired output so that we could help further on it.

    Best Regards,

    Cherry