Forum Discussion

newpbiuser01's avatar
newpbiuser01
Icon for Helper V rankHelper V
3 years ago
Solved

Unpivoting in DAX

Hello,   I currently have 8 different tables that are related to one another and I'm pulling in a name from each of the tables to create a comma seperated list of reportees for each manager. Unfort...
  • tamerj1's avatar
    2 years ago

    Hi newpbiuser01 

    Please try

    Table2 =
    seleactcolumns (
        GENERATE (
            Table1,
            VAR String = Table1[Reportees]
            VAR Items =
                SUBSTITUTE ( String, ", ", "|" )
            VAR Length =
                PATHLENGTH ( Items )
            VAR T =
                GENERATESERIES ( 1, Length, 1 )
            RETURN
                SELECTCOLUMNS ( T, "Reportee", PATHITEM ( Items, [Value] ) )
        ),
        "Manager",
        [Manager],
        "Reportee",
        [Reportee]
    )