Forum Discussion
Remove last digits
- Anonymous3 years ago
please write the column name like this [#"All: Net Profit"]
I need to do it for several columns. When I create the second one the first one disappear form the table.
How can I proceed?
Thanks
Giovanni
I have created a sample script so you can review the steps I did. You can paste it into the Power Query advanced editor and review the steps I made.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjRABUo6GEIGFkZYRJVidbDqNiJsoFJsLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [num1 = _t, num2 = _t, num3 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"num1", type number}, {"num2", type number}, {"num3", type number}}),
Custom1 = Table.AddColumn(#"Changed Type", "Custom", each [num1]/1000000000000000),
Custom2 = Table.AddColumn(Custom1, "Custom2", each [num2]/1000000000000000),
Custom3 = Table.AddColumn(Custom2, "Custom3", each [num3]/1000000000000000),
#"Removed Columns" = Table.RemoveColumns(Custom3,{"num1", "num2", "num3"}),
#"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Custom", "num1"}, {"Custom2", "num2"}, {"Custom3", "num3"}})
in
#"Renamed Columns"
- elfunambolo833 years agoRegular Visitor
Instead of num1,num2 etc.. I need to replace with my columns name?
- Anonymous3 years agoNot applicable
1) create an empty query.
2) Paste the script I wrote in the advanced editor.
3) Review after Custom 1 stepThen reflect the steps I created in your own query by changing the num1 names.
- elfunambolo833 years agoRegular Visitor
I replced num1 with my column name but I receive an error syntax