Forum Discussion
power-bi-noob
Helper I
3 years agoConditionally transform percentage to integer
I have some mixed data entered in a table column (some are percentages, some are integers). I'd like to transform some of the data permanently from percentage to integer only if the id number in anot...
v-jingzhang
Community Support
3 years ago
In Power Query Editor, add a custom column with
if [id] = 12345 and Text.Contains([value],"%") then Number.From([value]) else [value]
Then change this new column to Text data type. In Text data type, it can remain percentages and integers in the same column. If you change it to other data types (e.g. Number), values in a column will be converted into the same format.
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it. Highly appreciate your Kudos!
power-bi-noob
Helper I
3 years agoI am still getting a % in the column when I apply the formula.
If I change it to a whole number, then 100% shows up as 1, and so does 80% (rounding up). So I added then (Number.From([grade]) * 100), but still get 1 for each.