Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello,
I have a field with several job codes formated like this.
A123ABC
333BGT
5555TMGT
B4454JKRR
How can I create a new column in my query so that it creates a new value with the insertion of a "/" right after the last number so that the list above is
A123/ABC
333/BGT
5555/TMGT
B4454/JKRR
Thank you
J
Solved! Go to Solution.
This works
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcjQ0MnZ0claK1YlWMjY2dnIPATNNgSDEF8pxMjExNfHyDgpSio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Split Column by Character Transition" = Table.SplitColumn(Source, "Column1", Splitter.SplitTextByCharacterTransition({"0".."9"}, (c) => not List.Contains({"0".."9"}, c)), {"Column1.1", "Column1.2"}),
#"Merged Columns" = Table.CombineColumns(#"Split Column by Character Transition",{"Column1.1", "Column1.2"},Combiner.CombineTextByDelimiter("/", QuoteStyle.None),"Merged")
in
#"Merged Columns"
regards
Phil
Proud to be a Super User!
This works
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcjQ0MnZ0claK1YlWMjY2dnIPATNNgSDEF8pxMjExNfHyDgpSio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Split Column by Character Transition" = Table.SplitColumn(Source, "Column1", Splitter.SplitTextByCharacterTransition({"0".."9"}, (c) => not List.Contains({"0".."9"}, c)), {"Column1.1", "Column1.2"}),
#"Merged Columns" = Table.CombineColumns(#"Split Column by Character Transition",{"Column1.1", "Column1.2"},Combiner.CombineTextByDelimiter("/", QuoteStyle.None),"Merged")
in
#"Merged Columns"
regards
Phil
Proud to be a Super User!
wow!
thank you very much
Place the following M code in a blank query to see the steps.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcjQ0MnZ0claK1YlWMjY2dnIPATNNgSDEF8pxMjExNfHyDgoC8xyNjUF6TEycTE2B+mIB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Text.Insert([Column1],1+List.Max(Text.PositionOfAny([Column1],{"0".."9"},Occurrence.All)),"/"), type text)
in
#"Added Custom"
|
Please accept the solution when done and consider giving a thumbs up if posts are helpful. Contact me privately for support with any larger-scale BI needs, tutoring, etc. |
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
88 | |
63 |