Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Search a substring in string from another table with DAX

Hi everyone,   I need help figuring out how to search for a substring in another table with DAX. My data looks like this:   Table 1:   Customer ID Products IDs AA_019442 123456A;123456B...
  • barritown's avatar
    3 years ago

    Hi Anonymous,

     

    You can try this solution:

     

    However, you may not like some of its drawbacks:

    - sorting in Products IDs may not match sorting in Description;

    - if you have duplicates in Products IDs, they will have only one match in Description.

     

    If those things don't bother you, it should be fine.

     

    Here's the same calculated column in the text format:

    Description = 
    CONCATENATEX ( FILTER ( ADDCOLUMNS ( Table2,                
                                         "Presence", 
                                         CONTAINSSTRING ( [Products IDs], [Product ID] ) ), 
                            [Presence] = TRUE () ), 
                   [Description], 
                   ";" )

    Best Regards,

    Alexander

    My YouTube vlog in English

    My YouTube vlog in Russian