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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.