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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors