Forum Discussion

lilpumpkini's avatar
lilpumpkini
New Member
2 years ago
Solved

Identify whether value in string matches values in another table

Hi

I have a table called Group that has a concatenated list of Div Codes in a field called Open Divisions

ClientOpen DivisionsIn Scope
1EMYes
2AB, DE, PO, LMYes
3IJ, MN, STNo
4CG, XY, LMYes

 

I have another table called In Scope that has a list of Div Codes

In Scope Table

Div Code
EM
AB
FB
CG

 

I want to create a calculated column on the Group table where if one of the div codes listed in the string of "Open Divisions" matches any of the div codes in the Div Codes column of the In Scope Table, it should say Yes, Otherwise No.

 

 

  • Hi lilpumpkini 

     

    Use this DAX to create that calculated column:

    In Scope Check = 
    VAR OpenDivisionsList = SUBSTITUTE([Open Divisions], ", ", "|")
    RETURN
    IF(
        COUNTROWS(
            FILTER(
                'In Scope',
                SEARCH('In Scope'[Div Code], OpenDivisionsList, 1, 0) > 0
            )
        ) > 0,
        "Yes",
        "No"
    )

     

    Output:

     

     

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

    Appreciate your Kudos!! 

    LinkedIn | Twitter | Blog | YouTube 

3 Replies

  • Hi lilpumpkini 

     

    Use this DAX to create that calculated column:

    In Scope Check = 
    VAR OpenDivisionsList = SUBSTITUTE([Open Divisions], ", ", "|")
    RETURN
    IF(
        COUNTROWS(
            FILTER(
                'In Scope',
                SEARCH('In Scope'[Div Code], OpenDivisionsList, 1, 0) > 0
            )
        ) > 0,
        "Yes",
        "No"
    )

     

    Output:

     

     

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

    Appreciate your Kudos!! 

    LinkedIn | Twitter | Blog | YouTube