Forum Discussion
Extract number values from column
- 9 years ago
Anonymous
Hi, looks this link:
http://www.excelguru.ca/blog/2015/11/19/keep-only-numbers-in-power-query/
Anonymous
Hi, looks this link:
http://www.excelguru.ca/blog/2015/11/19/keep-only-numbers-in-power-query/
I tried out the ExcelGuru Link above, and it worked like a charm! Assuming you already have your data source setup, you can use the advanced query editor to add the cleansing steps.
1. To the beginning, add your variable:
(LET)
CharsToRemove = List.Transform({32,46,33..45,47,58..126}, each Character.FromNumber(_)),
2. At the end of your steps, add the following:
First, Add comma to the last line of your existing M query, before "IN", so it knows to continue when it gets to that line...
#"Changed TypeX" = Table.TransformColumnTypes(#"Previous M Step name",{{"Field to Convert", type text}}),
#"Added CustomX" = Table.AddColumn(#"Changed TypeX", "New Field Name", each Text.Remove([Field to Convert],CharsToRemove))
in
#"Added CustomX"
That should work, just swap out the bold text with your field names!