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
Betty888
Helper II
Helper II

Sort into grouped rows column

Dear Power Bi Community,

I have an issue with the group by function where the combined values are combination of 2 fields :

Field 1 = numbers

Field 2 = text

 

I’ve used the following formula to group rows :

= Table.Group(#"customized column", {"FactorA", "FactorB"}, {{"Combined value", each Text.Combine((List.Sort( [Field1 & Field2], Order.Ascending),"#(lf)"), type nullable text}})

 

with this formula, rows into each combined value is sorted but as following :

1 xxxx

10 xxxx

2 xxxx

while I’m looking for an order as :

1 xxxx

2 xxxx

10 xxxx

Any ideas to help with are more than welcome !

Many thanks in advance for your help !  

Regards,

1 ACCEPTED SOLUTION

Hi , @Betty888 

You can try this in "Advanced Editor" in Power Query Editor:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUUoCYnMLIFGRnFisFKuDEDU0ABLFiXCxZCA2AilEEzMFi4GFQNpS0JTBxExAYlArQNpS4VoT4WJpyOpiAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [FactorA = _t, FactorB = _t, #"Field 1" = _t, #"Field 2" = _t]),
    test = Table.TransformColumnTypes(Source,{{"FactorA", type text}, {"FactorB", type text}, {"Field 1", Int64.Type}, {"Field 2", type text}}),
    Custom1 = Table.Group(test, {"FactorA", "FactorB"}, {"Combined value",(x)=>Table.Sort(x,"Field 1")  })
in
    Custom1

The result is as follows:

vyueyunzhmsft_0-1666668239833.png

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

View solution in original post

4 REPLIES 4
wdx223_Daniel
Community Champion
Community Champion

List.Sort(lst,eacn Number.From(_))

Thank you for your reply! 

I don't know where to put your query?

Hi , @Betty888 

You can try this in "Advanced Editor" in Power Query Editor:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUUoCYnMLIFGRnFisFKuDEDU0ABLFiXCxZCA2AilEEzMFi4GFQNpS0JTBxExAYlArQNpS4VoT4WJpyOpiAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [FactorA = _t, FactorB = _t, #"Field 1" = _t, #"Field 2" = _t]),
    test = Table.TransformColumnTypes(Source,{{"FactorA", type text}, {"FactorB", type text}, {"Field 1", Int64.Type}, {"Field 2", type text}}),
    Custom1 = Table.Group(test, {"FactorA", "FactorB"}, {"Combined value",(x)=>Table.Sort(x,"Field 1")  })
in
    Custom1

The result is as follows:

vyueyunzhmsft_0-1666668239833.png

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

Many thanks ! 

It was really helpful !!!

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.