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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
pcowman
Helper I
Helper I

Multiple Rows into Multiple Columns

I have an SQL query that returns two columns with multiple values and I need to format it into a key value from the first column with multiple columns made from the values in the second column. I've looked and tried various methods (including pivot/unpivot) in Excel, SQL and Power BI. I'm hoping someone here can point me in the right direction for one of those. Here is a sample of the data being returned:

 

work order sample.PNG

 

What needs to happen is this:

 

work order sample-1.PNG

There may be 1 WC or there may be up to 21 (I believe). The current report -done through another product - shows up to 5.

1 ACCEPTED SOLUTION
LivioLanzo
Solution Sage
Solution Sage

Check this out:

 

https://www.mrexcel.com/forum/power-bi/1063813-convert-2nd-column-values-rows-when-column-1-same-nam...

 


 


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


Proud to be a Datanaut!  

View solution in original post

4 REPLIES 4
LivioLanzo
Solution Sage
Solution Sage

Check this out:

 

https://www.mrexcel.com/forum/power-bi/1063813-convert-2nd-column-values-rows-when-column-1-same-nam...

 


 


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


Proud to be a Datanaut!  

Wow, that is exactly what I need. Just I don't know how to add M Code to my file. I'm assuming it's in the Power Query.

Once you are in Power Query, you can go to the advanced editor. That is where the code is pasted

 

 

 


 


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


Proud to be a Datanaut!  

I thought so but hadn't tried it yet. Woot it worked! I would buy you the beverage of your choice if I could.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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