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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.