Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
vutruong91
Regular Visitor

Convert multiple column data into a column with multiple rows

Hi,

 

I currently have this data:


Capture.PNG

And I wish to have the following results:

 

Capture 1.PNG

 

How can I create this using the "New Table" function? I might also create a new excel sheet with the "Categories". How then can I utilize DAX 

 

Thanks in advance!

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

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

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





View solution in original post

4 REPLIES 4
GDUb
Advocate I
Advocate I

Is there a way to do this for an unknown / changing number of project values, so that formulas don't have to be rewritten every time a new project value is added to the data table? Thanks! 

Hi

 

You should use the unpivot on the power query. 

 

That way there is no need to rewrite


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





MFelix
Super User
Super User

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

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





Zubair_Muhammad
Community Champion
Community Champion

@vutruong91 

 

One way of manual unpivoting using DAX could be to select each column individually and then append it beneath other column

 

Table =
UNION (
    SELECTCOLUMNS (
        Table1,
        "For", "Project A",
        "Description", [Description],
        "Value", [Project A]
    ),
    SELECTCOLUMNS (
        Table1,
        "For", "Project B",
        "Description", [Description],
        "Value", [Project B]
    )
)

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.