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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
imnotabot01001
Regular Visitor

Group By column to unpivot

Hi all!

I have a table like such:

 

IDItemColor
a123001red
a123002blue
b456001blue
c789001red
c789002blue
c789003purple

 

and I need it to be grouped, then "unpivoted" like so:

 

IDItem1Color1Item2Color2Item3Color3Item4Color4
a123001red002bluenullnullnullnull
b456001bluenullnullnullnullnullnull
c789001red002blue003purplenullnull

 

How would I be able to do this? 

 

edit: there's a similar question here https://community.powerbi.com/t5/Desktop/Group-by-a-column-with-expansion/m-p/504490#M235507 , but doesn't count for irregular item counts down the ID. would appreciate any and all help! 😉

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I wonder whether a transformation of this type (second query in the file) is no longer useful.

But this can only be known by you depending on what you have to do next.

 

This solution can be simplified (see query ----2a)

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

iin this file (tab3) you find a parametric solution which manage case where you have a genric numbers of items(colours)

Anonymous
Not applicable

I wonder whether a transformation of this type (second query in the file) is no longer useful.

But this can only be known by you depending on what you have to do next.

 

This solution can be simplified (see query ----2a)

Anonymous
Not applicable

 

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.

Top Solution Authors