Unstack dataset

GreenCat223

New Member
Joined
Mar 27, 2024
Messages
8
Office Version
  1. 365
  2. 2021
  3. 2019
Platform
  1. Windows
Hi there,

I was wondering if you help me transform the following dataset?

This is how it comes out of the system:
EmpNumProductNameInputNameEntryValueProduct Entry ID
Emp1ApplesTypeGrannySmith
123​
Emp1ApplesUnits
5​
123​
Emp1ApplesTypeGala
456​
Emp1ApplesUnits
3​
456​
Emp1ApplesTypeBraeburn
789​
Emp1ApplesUnits
1​
789​
Emp1ApplesTypePinkLady
321​
Emp1ApplesUnits
7​
321​

This is how I want it to look like:

EmpNumProductNameTypeUnitsProduct Entry ID
Emp1ApplesGrannySmith
5​
123​
Emp1ApplesGala
3​
456​
Emp1ApplesBraeburn
1​
789​
Emp1ApplesPinkLady
7​
321​

All solutions are welcome!

Please explain your thought process with solving this as I can seem to crack this using Power Query!

Many thanks! :)
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
    cols = {"Type", "Units"},
    tblGroup = Table.Group(Source, {"EmpNum", "ProductName", "Product Entry ID"}, {{"rcd", each Record.FromList([EntryValue],cols)}}),
    tblExpand = Table.ExpandRecordColumn(tblGroup, "rcd", cols)
in
    tblExpand

Book1
ABCDEFGHIJKL
1Table2Query Output
2EmpNumProductNameInputNameEntryValueProduct Entry IDEmpNumProductNameProduct Entry IDTypeUnits
3Emp1ApplesTypeGrannySmith123Emp1Apples123GrannySmith5
4Emp1ApplesUnits5123Emp1Apples456Gala3
5Emp1ApplesTypeGala456Emp1Apples789Braeburn1
6Emp1ApplesUnits3456Emp1Apples321PinkLady7
7Emp1ApplesTypeBraeburn789
8Emp1ApplesUnits1789
9Emp1ApplesTypePinkLady321
10Emp1ApplesUnits7321
11
Sheet2
 
Upvote 1
Solution

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top