Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi Team,
I am looking for a solution to be implanted in query editor, that I need to take max string from each row.
For example:
| Loaded months | Output |
| M01 | M01 |
| M03 | M03 |
| M01,M02,M03 | M03 |
| M01,M03 | M03 |
| M03 | M03 |
| M04 | M04 |
| M01, M02 | M02 |
| M01, M02, M03 | M03 |
| M01, M02, M03 | M03 |
| M01, M02, M03 | M03 |
| M01, M02, M03, M04, M05, M06 | M06 |
Thanks for your support
Regards
Abhijit
Solved! Go to Solution.
You can add a column with this formua in it:
List.Max(List.Transform(Text.Split([Loaded months], ","), Text.Trim))
It splits the string up to a list, trims it (as you sometimes have spaces between your elements and sometimes not) and selects the MAX (in alphabetical order) from it.
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
is the data always sorted? if so you could just take last 3 characters
Text.End([Loaded months],3)
Hmm, the DAX for this wouldn't be that difficult. Maybe @ImkeF has a suggestion for Power Query.
You can add a column with this formua in it:
List.Max(List.Transform(Text.Split([Loaded months], ","), Text.Trim))
It splits the string up to a list, trims it (as you sometimes have spaces between your elements and sometimes not) and selects the MAX (in alphabetical order) from it.
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Thanks @ImkeF, this is the solution I am looking for.
Have a great day ahead!
Thanks and Regards
Abhijit
Oooo! Wait, this works:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8jUwVIrVAdHGUNpQx9fASAeVb4ymxgQupwBUjMIBEcbkiYAIExBhCiLMlGJjAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"Loaded months" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Loaded months", type text}}),
#"Replaced Value" = Table.ReplaceValue(#"Changed Type"," ","",Replacer.ReplaceText,{"Loaded months"}),
#"Added Custom" = Table.AddColumn(#"Replaced Value", "Custom", each List.Max(Text.Split([Loaded months],",")))
in
#"Added Custom"
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!