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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Solution Authors
Top Kudoed Authors