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
PatrickPerovan
Frequent Visitor

Row to Columns with ( Group ? )

Hey guys,

 

I'm trying to organize the information, as per the example below, in Power Query, but I'm a little stuck.

 

How can I do this?

 

I've tried using Group by, but I don't think that's the correct way to do it.



FROM:

 

Group NameMarket Name
DanoneAlcools 
DanonePizza
DanoneCheese
NestleAlcools 
NestleJuice

 

 

TO:

 

Group NameMarket Name 1Market Name 2 Market Name 3
DanoneAlcools PizzaCheese
NestleAlcools Juice 

 

 

Thanks,

2 ACCEPTED SOLUTIONS
PatrickPerovan
Frequent Visitor

I found a video with the answer!

If anyone need help in a futher:

 

View solution in original post

v-cgao-msft
Community Support
Community Support

Hi @PatrickPerovan ,

Please refer to the following steps, hope it helps:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcknMy89LVdJRcsxJzs/PKVaK1UESDMisqkpEFXLOSE0tTgWL+aUWl+Sg64ULepVmJgPVxQIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Group Name" = _t, #"Market Name" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Group Name", type text}, {"Market Name", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Group Name"}, {{"Market Name", each Text.Combine(List.Distinct([Market Name]),",")}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Grouped Rows", "Market Name", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Market Name.1", "Market Name.2", "Market Name.3"})
in
    #"Split Column by Delimiter"

vcgaomsft_0-1685339464497.png

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

2 REPLIES 2
v-cgao-msft
Community Support
Community Support

Hi @PatrickPerovan ,

Please refer to the following steps, hope it helps:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcknMy89LVdJRcsxJzs/PKVaK1UESDMisqkpEFXLOSE0tTgWL+aUWl+Sg64ULepVmJgPVxQIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Group Name" = _t, #"Market Name" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Group Name", type text}, {"Market Name", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Group Name"}, {{"Market Name", each Text.Combine(List.Distinct([Market Name]),",")}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Grouped Rows", "Market Name", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Market Name.1", "Market Name.2", "Market Name.3"})
in
    #"Split Column by Delimiter"

vcgaomsft_0-1685339464497.png

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

PatrickPerovan
Frequent Visitor

I found a video with the answer!

If anyone need help in a futher:

 

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