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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Flixy04
Regular Visitor

Transformation in Power Query

Hello together,

 

does somebody now how i can transform my table from the above view to the bottom view in PowerQuery Editor?

Flixy04_0-1690461060182.png

 

Best Regards

Flixy04

1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

plse try this

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQAA0MlHSUfEKFraqAUq4MqbgQkUIWNYMqBfAxxY5AxaBLGMHOMTDHFwRrQJExgEsZYxMEOBUvEAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [BLG = _t, LORT = _t, EUR = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"BLG", type text}, {"LORT", type text}, {"EUR", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"BLG"}, {{"Count", ( t ) => { t{0}[BLG] } & t[LORT] & t[EUR], type list  }}),
    Custom1 = List.Sort ( #"Grouped Rows"[Count], ( x ) => - List.Count ( x ) ),
    Custom2 = Table.FromList (
    Custom1,
    ( x ) => x,
    { "BLG"} & List.Transform ( { 1 .. List.Count ( Custom1{0} ) - 1 }, ( y ) => "Column" & Text.From ( y ) )
  )
in
    Custom2

View solution in original post

1 REPLY 1
Ahmedx
Super User
Super User

plse try this

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQAA0MlHSUfEKFraqAUq4MqbgQkUIWNYMqBfAxxY5AxaBLGMHOMTDHFwRrQJExgEsZYxMEOBUvEAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [BLG = _t, LORT = _t, EUR = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"BLG", type text}, {"LORT", type text}, {"EUR", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"BLG"}, {{"Count", ( t ) => { t{0}[BLG] } & t[LORT] & t[EUR], type list  }}),
    Custom1 = List.Sort ( #"Grouped Rows"[Count], ( x ) => - List.Count ( x ) ),
    Custom2 = Table.FromList (
    Custom1,
    ( x ) => x,
    { "BLG"} & List.Transform ( { 1 .. List.Count ( Custom1{0} ) - 1 }, ( y ) => "Column" & Text.From ( y ) )
  )
in
    Custom2

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.