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
jagostinhoCT
Post Partisan
Post Partisan

convert columns into rows. Not Unpivot....I think....

My query is producing the results below. Is there a way to convert it so that I have a single row for clashName 149 and all the left column values are spread out to its right, one on a separate column?

 

My current table has more clashName entries and I would like to do the same to each.

 

clashresultsclashName
FileClash149
rac_advanced_sample_project.nwcClash149
<No level>Clash149
Structural FramingClash149
Curved BeamClash149
Curved BeamClash149
Curved BeamClash149
Curved BeamClash149
Metal - Steel - ASTM A992Clash149
FileClash149
rac_advanced_sample_project.nwcClash149
01 - Entry LevelClash149
Structural ColumnsClash149
M_W-Wide Flange-ColumnClash149
W250X49.1Clash149
M_W-Wide Flange-ColumnClash149
Metal - Steel - 345 MPaClash149


  

Something like this... 

 

Clash149Filerac_advanced_sample_project.nwc<No level>Structural FramingCurved BeamCurved BeamCurved BeamCurved BeamMetal - Steel - ASTM A992Filerac_advanced_sample_project.nwc01 - Entry LevelStructural ColumnsM_W-Wide Flange-ColumnW250X49.1M_W-Wide Flange-ColumnMetal - Steel - 345 MPa

 

thank you

 

1 ACCEPTED SOLUTION
kamran_bsh
Regular Visitor

Hi

 

If I understand correctly, please use below steps

 

First Group by Clash name and  under operation use All rows

 

Then add a custom column using formula:

 

Text.Combine([Count][clashresults],", ")

 

This should give you the result you want. 

 

Capture.PNGCapture2.PNG

View solution in original post

3 REPLIES 3
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi  @jagostinhoCT,

 

By my tests, both of the solutions from kamran_bsh and Stachu should be right.

 

If you have solved your problem, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

 

If you still need help, please feel free to ask.

 

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
kamran_bsh
Regular Visitor

Hi

 

If I understand correctly, please use below steps

 

First Group by Clash name and  under operation use All rows

 

Then add a custom column using formula:

 

Text.Combine([Count][clashresults],", ")

 

This should give you the result you want. 

 

Capture.PNGCapture2.PNG

Stachu
Community Champion
Community Champion

try this

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("tZBNC4JAEIb/yrLnFC09eDTJU0ZgYGAi0zqUsa6x7lr9+zJvK3SIOs3XMzMvb57TuOZIZzTi0J1dL6DFLKcSWAlVD4JhVXbQXDmWV9lekClb3JiJH7TjLNimJRx75O9qcjJVUjOlJXASS2hqcTKJSMseK7JEaP4+SlC9hFgkVYhDDNNdQsIgmJvgD9xx3NeDlVDyQdaDPx+ciVquG9FN1JaZldUVkpiDOKE1YiaVzX1n7wW2+926acnC80myBRMbGsd3dh+z4gk=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [clashresults = _t, clashName = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"clashresults", type text}, {"clashName", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"clashName"}, {{"results", each _, type table}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each [results][clashresults]),
    #"Extracted Values" = Table.TransformColumns(#"Added Custom", {"Custom", each Text.Combine(List.Transform(_, Text.From), ";"), type text}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Extracted Values", "Custom", Splitter.SplitTextByDelimiter(";", QuoteStyle.Csv), {"Custom.1", "Custom.2", "Custom.3", "Custom.4", "Custom.5", "Custom.6", "Custom.7", "Custom.8", "Custom.9", "Custom.10", "Custom.11", "Custom.12", "Custom.13", "Custom.14", "Custom.15", "Custom.16", "Custom.17"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Custom.1", type text}, {"Custom.2", type text}, {"Custom.3", type text}, {"Custom.4", type text}, {"Custom.5", type text}, {"Custom.6", type text}, {"Custom.7", type text}, {"Custom.8", type text}, {"Custom.9", type text}, {"Custom.10", type text}, {"Custom.11", type text}, {"Custom.12", type text}, {"Custom.13", type text}, {"Custom.14", type text}, {"Custom.15", type text}, {"Custom.16", type text}, {"Custom.17", type text}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"results"})
in
    #"Removed Columns"


Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

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.