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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
jcastr02
Post Prodigy
Post Prodigy

Unpivoting into different columns

I am trying to group a column into one value that have the same work order, see example below.  Work order 29999 all seperate line items, but want to group the work order tag reason into one cell.  Trying to manipulate this in power query...

Current

Work Order NumberWork Order Tag ReasonReigonSite
12340 Reigon 6Store
25789 Reigon 6Store
29999FIX SLA 1Reigon 9DC
29999FIX SLA 2Reigon 9DC
29999FIX SLA 3Reigon 10DC

Expected Result 

Work Order NumberWork Order Tag ReasonReigonSite
12340 Reigon 6Store
25789 Reigon 6Store
29999FIX SLA 1, FIX SLA 2, FIX SLA 3Reigon 9DC
1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @jcastr02 ,

 

Here you go:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQyNjFQ0lFSAOKg1Mz0/DwFMyAzuCS/KFUpVidaycjU3MISrwJLIACKuHlGKAT7OCoYIhSChF2csaoyIkqVMaaqWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Work Order Number" = _t, #"Work Order Tag Reason" = _t, Reigon = _t, Site = _t]),
    chgAllTypes = Table.TransformColumnTypes(Source,{{"Work Order Number", type text}, {"Work Order Tag Reason", type text}, {"Reigon", type text}, {"Site", type text}}),
    groupRowsList = Table.Group(chgAllTypes, {"Work Order Number", "Reigon", "Site"}, {{"Work Order Tag Reason", each Text.Combine([Work Order Tag Reason], ", "), type nullable text}})
in
    groupRowsList

 

It's a basic Power Query group function, but you switch out one of the standard operators from the GUI to the Text.Combine function instead.

 

Gives me this:

BA_Pete_0-1612879733732.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

3 REPLIES 3
BA_Pete
Super User
Super User

Hi @jcastr02 ,

 

Here you go:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQyNjFQ0lFSAOKg1Mz0/DwFMyAzuCS/KFUpVidaycjU3MISrwJLIACKuHlGKAT7OCoYIhSChF2csaoyIkqVMaaqWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Work Order Number" = _t, #"Work Order Tag Reason" = _t, Reigon = _t, Site = _t]),
    chgAllTypes = Table.TransformColumnTypes(Source,{{"Work Order Number", type text}, {"Work Order Tag Reason", type text}, {"Reigon", type text}, {"Site", type text}}),
    groupRowsList = Table.Group(chgAllTypes, {"Work Order Number", "Reigon", "Site"}, {{"Work Order Tag Reason", each Text.Combine([Work Order Tag Reason], ", "), type nullable text}})
in
    groupRowsList

 

It's a basic Power Query group function, but you switch out one of the standard operators from the GUI to the Text.Combine function instead.

 

Gives me this:

BA_Pete_0-1612879733732.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Hi @jcastr02 ,

 

Did this work ok for you? I saw that you kudoed but didn't mark as the solution.

If this isn't working for you then let me know what's wrong and I'll have another look.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




amitchandak
Super User
Super User

@jcastr02 , You can create a measure and use that in visual

 

concatenatex(Table, Table[Work Order Tag])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

Top Kudoed Authors