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
shubuya
Frequent Visitor

Breaking Apart a Large Table (Wide) into Long Format Where Unpivot Doesn't' Work

I have one table as follows:

Column A, Column B, Column C, Column D, Column E, Column F, Column G   ...  Column n

 

Each sequence of 1 - 4 columns is a category that could be it's own table. Generally the pattern is 'Dim 1, Dim 2, Fact 1, Fact 2'. I want to append the columns that are of the same type (e.g. C & G are Fact 1 = 'Cost'). They all follow the same pattern, but some sequences contain an extra descriptive dimension or only one Fact. 

 

If you were viewing these as seperate tables it might look something like this:

 

*where bold = same column type

Table 1 = A, B, C

Table 2 = D, E, F, G

Table n = X, X, X, X (max of 4 possible columns)

 

And you could append as such (C & G are the same type in this scenario):

A, B, C, x (x = added custom column with null values)

D, E, G, F

X, X, X, X

 

So ultimately I want to convert this wide table to one long table with as few operations as possible. The way I am doing it now is creating a reference table for each category (e.g. sequence of 1 - 4 columns, changing the column names so they are consistent, adding/ rearranging columns, and appending them together in one table). This is a lot of steps since I have approx 14 categories.

 

 

1 REPLY 1
parry2k
Super User
Super User

@shubuya you have provided all the details but it will be easier if you put sample data in excel sheet and also add a sheet with expected result.

 

Read this post for best practice to get your answer quickly 

 

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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.