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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors
Top Kudoed Authors