cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
beternal
New Member

Transposing issue

Hi

 

I have data in multiple sheets in multiple files and the data is arranged thus:

 

Sheets 1-50

col1            col2          

header1     1

header2     2

header3     3

 

...but when I power query it, the data ends up alongside each other rather than stacking...

 

I want it to transpose to look like:

 

header1     header2     header3

1                2                3

 

Nice and easy... but when I combine the tabs and transpose, the data ends up alongside each other:

 

header1     header2     header3     header1     header2     header3     header1     header2     header3

1                2                3                1                2                3                 1                2                3

 

What am I doing wrong?

 

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Hi @beternal ,

You can create a custom function like this:

let
    Source = (tab as table, x) => Table.SelectRows(tab, each [col1] = x)[col2]{0}
in
    Source

Invoke this function in Table1 for Table2, Table3..., then you can transpose the table and use the first row as header

re.png

 

Best Regards,
Community Support Team _ Yingjie Li
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-yingjl
Community Support
Community Support

Hi @beternal ,

You can create a custom function like this:

let
    Source = (tab as table, x) => Table.SelectRows(tab, each [col1] = x)[col2]{0}
in
    Source

Invoke this function in Table1 for Table2, Table3..., then you can transpose the table and use the first row as header

re.png

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

watkinnc
Super User
Super User

You should add a column of null values, then place it at the first colun position, and then tranpose:

 

= Table.AddColumn(#"Name of Table or Last Step Name", "Nulls", each null)

 

Now your transpose will work, and you can then Promote Headers.

 

--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!

Helpful resources

Announcements
Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May 23 2022 epsiode 5 without aka link.jpg

The Power BI Community Show

Welcome to the Power BI Community Show! Jeroen ter Heerdt talks about the importance of Data Modeling.

Power BI Dev Camp Session 22 with aka link 768x460.jpg

Check it out!

Mark your calendars and join us on Thursday, May 26 at 11a PDT for a great session with Ted Pattison!

charticulator_carousel_with_text (1).png

Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!