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
Anonymous
Not applicable

Stack Multiple Columns

I have a terrible spreadsheet I can't change the format of . . . .  It's multiple serial numbers across 4 different columns with their individual statuses. 

 

How can I stack all these columns into one set so I can pivot the data after the back?  

 

it goes from Serial Number 1 through 50, then S/2 Column starts at 51 and goes to 100.  Each is followed by a status column . . .

 

2022-06-07 12_32_17-SN List WO39166  (108586).xlsx  -  Read-Only - Excel.png

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

You can make 4 versions(copies) of the table.

Remove the appropriate columns so that each version has s/n and status for a pair of columns (1, or 2 or 4 or 8).

Rename the columns in each version to s/n and status. (they must be the same in each version)

Append the tables.

View solution in original post

3 REPLIES 3
HotChilli
Super User
Super User

You can make 4 versions(copies) of the table.

Remove the appropriate columns so that each version has s/n and status for a pair of columns (1, or 2 or 4 or 8).

Rename the columns in each version to s/n and status. (they must be the same in each version)

Append the tables.

Anonymous
Not applicable

This makes a lot of sense; I didn't think logically about it - I can also teach this to someone who doesn't know Power Query.

wdx223_Daniel
Super User
Super User

NewStep=#table({"S/N","Status"},List.TransformMany(List.Split(Table.ToColumns(PreviousStepName),2),List.Zip,(x,y)=>y))

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.

Top Solution Authors
Top Kudoed Authors