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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
AJPF
Helper I
Helper I

pivoting columns

Hello all, 

 

I have some data (only 2 columns) which looks this: 

 

ID Note

100 This

100 is

100 an

200 example

200 of

200 what

300 I 

300 need 

300 to

300 see

 

What I want is this:

 

ID Note1 Note2 Note3 Note4

100 This is an (blank)

200 example of what (blank) 

300 I need to see

 

How do I accomplish this?  Am I heading in the right direction by trying to pivot it? 

 

Thanks

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@AJPF 

you can try this

1. group by

= Table.Group(#"Changed Type", {"id"}, {{"Count", each Text.Combine([NOTE]," "), type nullable text}})

2. split the new column by space

3. change the column name

pls see the attachment below

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

7 REPLIES 7
parry2k
Super User
Super User

@AJPF Although @ryan_mayu  solution is awesome I will not go that route, reason if you have one ID with let's 8 columns, it will create 8 columns for each ID with a blank value and that is unnecessary. From my point of view, it is not efficient. Just my 2 cents. Good luck!

 

 



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.

When I have more time, I may try your solution.  I just needed something quick and easy to get the report out!  Thanks. 

ryan_mayu
Super User
Super User

@AJPF 

you can try this

1. group by

= Table.Group(#"Changed Type", {"id"}, {{"Count", each Text.Combine([NOTE]," "), type nullable text}})

2. split the new column by space

3. change the column name

pls see the attachment below

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




This works really well, thank you, but is there any way of making the count of Count dynamic?  At the moment, the "Split Column by Delimiter" splits into Count.1 - Count.4.  What happens if one of my IDs has more than 4 notes?  Thanks. 

Ignore me, I can see that it does it automatically.  Marked as solution, thank you. 

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




parry2k
Super User
Super User

@AJPF pivoting is not a good idea, usually, you want unpivoted data. in this case, you can add an index column grouped by each ID, and then in matrix visual, you can have ID on the rows, INdex on columns, and Note on the values and that will do it. This post will help to add an index.

 

Follow us on LinkedIn

 

Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



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
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors