Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

How to compare string values from column in one table with column in another table

I have SITES table with one column with 178 unique values named CODE

I have another table PILOT where I have NAME column which may contain CODE from SITES table somewhere in its name.

 

How can I identify NAMEs in PILOT table which contains CODE from SITES?

 

------

PILOT[NAME] is like:

XX-SSADASD-asdas-12313-SRLSGEAB-123123

SS-XXXSSA-FRNKGEDM-sssadas-SRLSGEAB-123123

 

SITES[CODE]:

  • Anonymous  with DAX

    Measure = 
    VAR nm =
        MAX ( pilot[pilot.name] )
    RETURN
        CONCATENATEX (
            FILTER ( site, CONTAINSSTRING ( nm, site[site.code] ) ),
            [site.code],
            ", ",
            site[site.code], ASC
        )

     

     

     

    PFA

     

3 Replies

  • Anonymous , New column in power query

     

    if( List.Count(List.Select(PILOT[NAME], each Text.Contains(_,[CODE])))>0, 1, 0)

  • smpa01's avatar
    smpa01
    Icon for Community Champion rankCommunity Champion

    Anonymous  with DAX

    Measure = 
    VAR nm =
        MAX ( pilot[pilot.name] )
    RETURN
        CONCATENATEX (
            FILTER ( site, CONTAINSSTRING ( nm, site[site.code] ) ),
            [site.code],
            ", ",
            site[site.code], ASC
        )

     

     

     

    PFA

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      This is quite good, but can it shows also values when there is no match?