Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hello,
I need some help removing a symbol ("-") if it exists in the beginning of a column value, but keep it if it exists elswhere in the value (not at the beginning).
E.g.:
| Column | Result Column |
| -alex | alex |
| john | john |
| a-albert | a-albert |
| -dan | dan |
| b-judy | b-judy |
Any thoughts?
Thanks!
Solved! Go to Solution.
I have used a series of steps in "Power query".
please find below the query code with all the steps:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W0s1LzE1VitWJVipJLS7RLUBiFujqKsXGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Test = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Test", type text}}),
#"Inserted First Characters" = Table.AddColumn(#"Changed Type", "First Characters", each Text.Start([Test], 1), type text),
#"Extracted Text Range" = Table.TransformColumns(#"Inserted First Characters", {{"Test", each Text.Middle(_, 1, 10000000), type text}}),
#"Replaced Value" = Table.ReplaceValue(#"Extracted Text Range","-","",Replacer.ReplaceText,{"First Characters"}),
#"Merged Columns" = Table.CombineColumns(#"Replaced Value",{"First Characters", "Test"},Combiner.CombineTextByDelimiter("", QuoteStyle.None),"Merged")
in
#"Merged Columns"
I also found a way to do it in DAX:
CleanUp = IF(LEFT([Column], 1)="-", MID([Column], 2,LEN([Column])),[Column])
I also found a way to do it in DAX:
CleanUp = IF(LEFT([Column], 1)="-", MID([Column], 2,LEN([Column])),[Column])
I have used a series of steps in "Power query".
please find below the query code with all the steps:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W0s1LzE1VitWJVipJLS7RLUBiFujqKsXGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Test = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Test", type text}}),
#"Inserted First Characters" = Table.AddColumn(#"Changed Type", "First Characters", each Text.Start([Test], 1), type text),
#"Extracted Text Range" = Table.TransformColumns(#"Inserted First Characters", {{"Test", each Text.Middle(_, 1, 10000000), type text}}),
#"Replaced Value" = Table.ReplaceValue(#"Extracted Text Range","-","",Replacer.ReplaceText,{"First Characters"}),
#"Merged Columns" = Table.CombineColumns(#"Replaced Value",{"First Characters", "Test"},Combiner.CombineTextByDelimiter("", QuoteStyle.None),"Merged")
in
#"Merged Columns"
Hi, @Uspace87,
Thanks a lot, this helps. Can you let me know how you added the "Inserted First Characters" step?
Best regards!
Thank you!
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 5 | |
| 4 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 24 | |
| 12 | |
| 11 | |
| 9 | |
| 8 |