Forum Discussion
Group by with Text.Combine+List.Transform
- 5 years ago
I found the solution here:
PowerQuery order of words in Text.Combine - Stack Overflow
We first need to override the Power BI internal sort using Table.Buffer and then sort by Console ascending and Game ascending.
The Text.Combine has no means of sorting, this Table.Buffer needs to be a previous step in the query.
coathangers - Only difference I see is an opening " { ".
= Table.Group(#"Changed Type", {"Console"}, {{"Games", each Text.Combine(List.Transform([Game], Text.From), " | "), type text, Order.Ascending}})
- coathangers5 years agoFrequent Visitor
I found the solution here:
PowerQuery order of words in Text.Combine - Stack Overflow
We first need to override the Power BI internal sort using Table.Buffer and then sort by Console ascending and Game ascending.
The Text.Combine has no means of sorting, this Table.Buffer needs to be a previous step in the query.
- Anonymous5 years agoNot applicable
You can also use this:
= Table.Group(#"Changed Type", {"Console"}, {{"Games", each Text.Combine(List.Sort([Game]), " | " ), type text}})
- coathangers5 years agoFrequent Visitor
Thanks for the reply.
Sorry that code was typed rather than copied from the source and I forgot the {. The source data I have is sensitive so can't copy directly.
Even with that opening { (which is how the code in my query actually is) the Order.Ascending has no effect, the concatentation is in reverse alphabetical order for some reason. Did you try Order.Descending in your query, and did that have any effect?
Many thanks,