Forum Discussion
Sort text within a single cell
- 3 years ago
Hi Cyrilbrd
The following code ahieves this
let Replace1 = Replacer.ReplaceText([Column]," "," "), Replace2 = Replacer.ReplaceText(Replace1," "," "), Split = Text.Split(Replace2, " "), Trim = List.Transform(Split, each Text.Trim(_)), Sort = List.Sort(Trim), Combine = Text.Trim(Text.Combine(Sort," ")) in CombineI assume now it creates a conflict wwith the other requirement. If yes, please now provide a list of different combination with input column and oputput column. Otherwise it will be endless back and forth 🙂
Best regards
Michael
-----------------------------------------------------
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Appreciate your thumbs up!
@ me in replies or I'll lose your thread.
Cyrilbrd , Are these row values of column value, You can create a new column in power Query like
If [Column] ="W" then 0
else If [Column] ="C" then 1
else 3
Add additional else as per need
Mark that new column as sort column
How to Create Sort Column and Solve Related Errors:
https://www.youtube.com/watch?v=KK1zu4MBb-c
- Cyrilbrd3 years agoHelper IV
Thanks for the proposed solution but this would not work, as several databases exist and new types may be added as business grows.
The proposal from Mikelytics works well with the present model.