Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hello,
Please I would like some help.
I have this database here, and in the "Cód.Serviço" column there are numeric codes, codes with letters and numbers and codes with letters/numbers/letters again, as below, and I would like where there is a letter/number/letter to remove only the last letters, for example: from S14.01MCV to S14.01, from S14.01J to S14.01, how could I do that?
Thanks,
Marcia.
Solved! Go to Solution.
One method would be to find the position of the first letter in the string that is not in the first position and then use that value to extract the string from the start to the determined value.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQyNjE1U4rViVYKNjUzgjDMTM1MHNPcwBxHU5NkMMPI0MzUBMwCylqYJJUpxcYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Added Custom" = Table.AddColumn(Source, "TextLocations", each List.Min(List.RemoveItems(Text.PositionOfAny([Column1], {"a".."z", "A".."Z"}, Occurrence.All), {0}))),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "NewColumn", each try Text.Start([Column1], [TextLocations]) otherwise [Column1])
in
#"Added Custom1"The code above walks through the steps.
Hope this helps.
Proud to be a Super User! | |
Hi @Anonymous
You can try the following code.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCjY00TMw9HUOU4rVgfG8lGJjAQ==", 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.Start([Column1],List.Max(Text.PositionOfAny([Column1],{"0".."9"},Occurrence.All))+1))
in
#"Added Custom"
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous
You can try the following code.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCjY00TMw9HUOU4rVgfG8lGJjAQ==", 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.Start([Column1],List.Max(Text.PositionOfAny([Column1],{"0".."9"},Occurrence.All))+1))
in
#"Added Custom"
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
One method would be to find the position of the first letter in the string that is not in the first position and then use that value to extract the string from the start to the determined value.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQyNjE1U4rViVYKNjUzgjDMTM1MHNPcwBxHU5NkMMPI0MzUBMwCylqYJJUpxcYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Added Custom" = Table.AddColumn(Source, "TextLocations", each List.Min(List.RemoveItems(Text.PositionOfAny([Column1], {"a".."z", "A".."Z"}, Occurrence.All), {0}))),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "NewColumn", each try Text.Start([Column1], [TextLocations]) otherwise [Column1])
in
#"Added Custom1"The code above walks through the steps.
Hope this helps.
Proud to be a Super User! | |
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |