Forum Discussion

vutruong91's avatar
vutruong91
Regular Visitor
7 years ago
Solved

Convert multiple column data into a column with multiple rows

Hi,   I currently have this data: And I wish to have the following results:     How can I create this using the "New Table" function? I might also create a new excel sheet with th...
  • MFelix's avatar
    7 years ago

    Hi vutruong91 ,

     

    The easist way is on the query editor, select the columns Project and choose unpivot columns. This is my recommend way.

     

    However you can also do this in DAX you can do the following formula:

     

    DAX_Table =
    UNION (
        SELECTCOLUMNS (
            Projects_Dax;
            "DESCRIPTION"; Projects_Dax[Description];
            "VALUE"; Projects_Dax[Project A];
            "FOR"; "Project A"
        );
        SELECTCOLUMNS (
            Projects_Dax;
            "DESCRIPTION"; Projects_Dax[Description];
            "VALUE"; Projects_Dax[Project B];
            "FOR"; "Project B"
        );
        SELECTCOLUMNS (
            Projects_Dax;
            "DESCRIPTION"; Projects_Dax[Description];
            "VALUE"; Projects_Dax[Project C];
            "FOR"; "Project C"
        );
        SELECTCOLUMNS (
            Projects_Dax;
            "DESCRIPTION"; Projects_Dax[Description];
            "VALUE"; Projects_Dax[Project D];
            "FOR"; "Project D"
        )
    )

    Check attach the PBIX file with both options.

     

    Regards,

    MFelix