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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
KelvinMorel
Helper II
Helper II

Transform duplicate rows into columns ordered by categories

Hi all,

I got to transform duplciated category rows into columns using:

= Table.Group(Source, {"ID", "ORDER"}, {{"CATEGORY", each Text.Combine([CATEGORY], ","), type nullable text}})

then split the CATEGORY column

Starting dataset (Dummy data)

KelvinMorel_0-1699638666509.png

I get everything scrambled 

screenshot_10112023_04.jpg

I would like to order the different categories by columns as follows

IDORDERMOBILESOUND
008328810079PhoneHeadset
008794810078Phonenull
008560810077nullHeadset

 

Any idea is welcome

 

Cheers

4 REPLIES 4
ronrsnfld
Super User
Super User

Why not make it easy for someone to help you by providing your dummy data as text which can be easily copy/pasted into Excel or Power BI? Your screenshot is not particularly useful, although you might find someone willing to take the time to transcribe it, you'll probably get more responses if you make it easier.

 

Also, I do not see in your data any method to decide which column the different listed categories should go into.

 

In other words, how do we know which are "mobile" and which are "sound"?

 

 

Hi @ronrsnfld,

Fair enough but I didn't realize the "dummy data" would be a big deal, maybe I need reformulate the question:

How do I order the data get the same sequence before transforming it?

 

Cheers,

Hi, @KelvinMorel 

let
    Source = your_table,
    g = Table.Group(Source, {"ID", "ORDER"}, {{"all", each [a = List.Distinct([MOBILE]), b = Record.FromList(a, a)][b]}}),
    expand = Table.ExpandRecordColumn(g, "all", List.Distinct(Source[MOBILE]))
in
    expand

you may rename columns later. 

One way would be by using the Table.Group function.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.