Forum Discussion

sshanssun's avatar
sshanssun
Helper I
1 year ago
Solved

CONCATENATEX gives different result

Hi, I have 2 tables, Table 1 and Table2.   Table 1 is a master table and Table 2 is a look up Table. Under Table 1, I have a value column where the values should lookup with values in Table2 and re...
  • lbendlin's avatar
    1 year ago

    You use SEARCH which has no idea about the structure of your strings (the delimiters).  You need to use PATH functions.

     

    Result =
    VAR p =
        SUBSTITUTE ( [Value], ",", "|" )
    RETURN
        CONCATENATEX (
            ADDCOLUMNS (
                GENERATESERIES ( 1, PATHLENGTH ( p ) ),
                "s",
                    VAR v = [Value]
                    RETURN
                        MAXX ( FILTER ( 'Table 2', PATHITEM ( p, v ) = [Value] ), [Category] )
            ),
            [s],
            ","
        )