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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Ry009
Helper II
Helper II

Splitting columns into multiple rows

Will preface this by saying I've exhausted all research for this problem, both here and elsewhere online, I am not sure how else to present this data for help. 

 

I have no idea why the data is required in this format, but unfortunately, it is.

 

I need to split columns 6-12 onto a secondary row.

 

Ry009_2-1718676719026.png

 

So it would be then presented like this;

 

Ry009_1-1718676674523.png

 

Is this easily doable in Power Query?

1 ACCEPTED SOLUTION

To achive the desired result you can use index column: before appending datasets you create an index in each of them. After you append queries as new they will be listed one under another (so Dataset A and then Dataset B). However, because you index column, you can sort them in a desired way (once you're done, you can delete index column in the final dataset in case you don't need it anymore):

Sergii24_0-1723894460812.png


I also don't remember whether you start with 2 separate datasets or you have just one, which you first need to split. In attached pbix you'll find both option (when you select one of them, just delete the second)

Sergii24_1-1723894578578.png


Is it what you've been looking for? 🙂

View solution in original post

11 REPLIES 11
Anonymous
Not applicable

Hi @Ry009 ,

 

Thanks to @Sergii24  and @Kishore_KVN  for the detailed explanations and steps. If you are still not clear, I have provided a pbix file for your reference, you can click "transform data" to enter the power query and then check the steps on the right side of the step column.

(1)Copy the original table to get Table 2, delete the redundant columns and then add customized columns.

vtangjiemsft_0-1719367141554.png

(2) Copy the original table to get Table 3, delete the redundant columns, and then add customized columns.

vtangjiemsft_1-1719367265067.png

(3) Append table 2 and table 3.

vtangjiemsft_2-1719367383809.png

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

Kishore_KVN
Super User
Super User

Hello @Ry009 , 

Yes in Power Query Editor its doable. follow below steps:

1. Duplicate this table twice in PQE

2. Select till Language Code column from first and remove other columns in first copy also add new custom column Information Type = "Dataset A".

3. Select till Language code column from first and remove selected columns in second copy also add new custom column Information Type = "Dataset B".

4. Select Append Queries as New in Append option and combine copy two and three also disable loading of copy one, two and three into Power BI Desktop. 

 

Attached similar activity performed in Excel for reference. 

 

If this post helps, then please consider accepting it as the solution to help other members find it more quickly. Thank You!!

Thank you for responding.

 

Could you advise how you did the join and separate column rows on the next line?

Hi @Ry009, I think @Kishore_KVNhas provided great explanation for your problem. Let me try to provide some more details on why it works 🙂

First you split the initial dataset in 2 (those that you need to append later on), once they "Dataset A" and "Dataset B" are ready (steps #2 and #3 from the previous reply you've got), you need to combine them.

In this case you don't need join, because join is a subset of initial datasets. What you want to do is to append them (i.e. place one under another). When you ask Power Query to do so, it will first search for columns with the same names and, if found, place rows from "Dataset B" under those of "Dataset A". If Power Query fails to find columns with the same names, it will add new columns (those of "Dataset B" to those present in "Dataset A"), which is what you've asked! Now, because you used append, Power Query will not try to place them on the same row but simply put one under another and because columns from "Dataset B" were not there in "Dataset A", you get blank values in new columns (from Dataset B) for existing rows of "Dataset A" and vice versa.

I hope this explanation makes its clearer now 🙂

Assuming what I've suggested isn't possible?

Thanks for the reply.

This is the only option I have for 'Append as New'. When I do this, all it does is put the entire table underneath the other, not alternating rows like my expected output above.

Ry009_0-1719357652369.png

 

What are the columns of "Orange" and "Pink" tables? Are column names the same? You need to have different column names to achieve the desired result.

Let's summarize once again how "Append" works: first it searches for columns with the same names in the input tables. If found, rows of those columns are appended one under another. In the case when column names are different (so append can't find same names), columns that don't exist in the first table are added to the second one (rows of the first table for that new columns remain empty).

Sergii24_0-1721027383314.png


Check pbix attached for further details.

Good luck with your project and have a great day 🙂

Hi Sergii

 

Thanks for getting back to me. I think I may not have explained correctly. I have multiple rows of data, not just one. And when I append, rather than alternating rows, its putting the two separate tables under one another, hope that makes sense?

 

So just to recap this is an example of what I start with

Ry009_0-1723589471181.png

Want to achieve this

Ry009_1-1723589492715.png

But append only does this;

Ry009_2-1723589531048.png

 

Hi,

Share some data to work with and show the expected result very clearly.  It is very difficult to understand your requirement from small images.  Share data in a format that can be pasted in an MS Excel file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

To achive the desired result you can use index column: before appending datasets you create an index in each of them. After you append queries as new they will be listed one under another (so Dataset A and then Dataset B). However, because you index column, you can sort them in a desired way (once you're done, you can delete index column in the final dataset in case you don't need it anymore):

Sergii24_0-1723894460812.png


I also don't remember whether you start with 2 separate datasets or you have just one, which you first need to split. In attached pbix you'll find both option (when you select one of them, just delete the second)

Sergii24_1-1723894578578.png


Is it what you've been looking for? 🙂

Thank you so much Sergii!

This is what I was after (from single dataset) 🙂 

 

What I neglected to include the requirement that the primary id in column A needs to be represented in the row underneath it for the corresponding index.

After 30 mins of looking for a solution.....stupid me realised, just keep it in both tables so when it appends, it will be in both. 🙂

 

Thank you so much!

 



 

 



Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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