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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
vyny17
Frequent Visitor

Create a "pivot" table from 6 columns of another table

Hi , greetings!

 

I have this table:

 

vyny17_0-1658182556473.png

 

I wanna create a new table (DAX code preferably) concatenating column headers with its respective items, like this:

 

vyny17_1-1658182697154.png

 

If you can help me on this thing I'd be thankful!!!

 

 

 

Here's the sample table:

 

Click to download (Mirror: MediaFire) 

 

 

 

 

 

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi , @vyny17 ;

You could try it by dax.

New = UNION(SELECTCOLUMNS('Table',"Item",[1],"Index","1"),
SELECTCOLUMNS('Table',"Item",[2],"Index","2"),
SELECTCOLUMNS('Table',"Item",[3],"Index","3"),
SELECTCOLUMNS('Table',"Item",[4],"Index","4"),
SELECTCOLUMNS('Table',"Item",[5],"Index","5"),
SELECTCOLUMNS('Table',"Item",[6],"Index","6"),
SELECTCOLUMNS('Table',"Item",[A],"Index","A"))

The final show:

vyalanwumsft_0-1658378270530.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi , @vyny17 ;

You could try it by dax.

New = UNION(SELECTCOLUMNS('Table',"Item",[1],"Index","1"),
SELECTCOLUMNS('Table',"Item",[2],"Index","2"),
SELECTCOLUMNS('Table',"Item",[3],"Index","3"),
SELECTCOLUMNS('Table',"Item",[4],"Index","4"),
SELECTCOLUMNS('Table',"Item",[5],"Index","5"),
SELECTCOLUMNS('Table',"Item",[6],"Index","6"),
SELECTCOLUMNS('Table',"Item",[A],"Index","A"))

The final show:

vyalanwumsft_0-1658378270530.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

VahidDM
Super User
Super User

Hi @vyny17 

 

You can easily find the result in Power Query by using Unpivote Columns. Select All columns and then click on the Unpivote Columns in Transform tab.

 

Download the sample file attached.

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!! 

Badges.jpg

LinkedIn | Twitter | Blog | YouTube 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.