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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ddalton
Resolver I
Resolver I

Grouping same IDs and creating new columns from their respective values

Hey, folks. Brand new to Power BI but I'll do my best to describe my scenario. 

 

I have multiple tables that I've imported into Power BI Desktop. I have created the following relationships between the tables:

 

Table_A          Table_B

  Index     *:1    Index

 

Here's a representation of the dataset:

 

IndexDate_TimeIDCodeValue
2227/05/2022 00:00573A1250
40627/05/2022 00:00229A1143
64527/05/2022 00:00601C1250
1527/05/2022 00:00477A1250
1527/05/2022 00:00477S1235
2027/05/2022 00:00482A1250
2027/05/2022 00:00482C1265
2827/05/2022 00:00488A1250
3427/05/2022 00:00494A1250
2827/05/2022 00:00488S1135
3427/05/2022 00:00494S1140
3927/05/2022 00:00499A1250

 

You'll note that there are multiple records for certain Index and ID values (i.e., Index 28 and ID 488 has a row entry for Code A1 and another row entry for Code S1). 

 

I want to create a new table that essentially groups the Index and ID columns and creates new columns for each unique Code value and matches their respective Value into a single row, like below:

 

IndexDate_TimeIDA1C1S1
2227/05/2022 00:00573250  
40627/05/2022 00:00229143  
64527/05/2022 00:00601 250 
1527/05/2022 00:00477250235 
3427/05/2022 00:00494250 140
3927/05/2022 00:00499250  
2827/05/2022 00:00488250 135
2027/05/2022 00:00482250265 

 

What's the best way to handle this in Power BI Desktop? I've tried playing around with grouping in the GUI but I just can't seem to figure it out. 

 

1 ACCEPTED SOLUTION
tackytechtom
Super User
Super User

Hi @ddalton ,

 

How about pivoting in Power Query:

tomfox_0-1654512288511.png

 

All you need to do is marking the Code column (left click), choose the transform ribbon, click on pivot column, select Value as Value Column and click ok:

tomfox_1-1654512405418.png

 

 

Let me know if this helps or if you get stuck soemwhere 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/

 



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

What was the solution to the null errors? I am trying to do the same thing as above but my Code is a course title.

 

It is not merging all the Unique IDs but leaving some duplicates with Null Values.

 

My values are all text, not numerical.

tackytechtom
Super User
Super User

Hi @ddalton ,

 

How about pivoting in Power Query:

tomfox_0-1654512288511.png

 

All you need to do is marking the Code column (left click), choose the transform ribbon, click on pivot column, select Value as Value Column and click ok:

tomfox_1-1654512405418.png

 

 

Let me know if this helps or if you get stuck soemwhere 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/

 



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Hi @tackytechtom,

 

Thanks for suggestion - that's definitely the trick for it. It was something I'd been playing around with but kept getting errors with I've managed to resolve now (null/blank values etc.)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.