Forum Discussion
Error based on a column
- 1 year ago
smokeyjoe03 , but i need to keep that "Less than year" value in my column along with the numerical values . How can I go about it?
- 1 year ago
The column will have to remain as a string in that case, the "Change Type" operation operates on every value in the column so even just 1 value that isn't a number or NULL will cause the error.
As a workaround I suggest making two columns:- A Number column but replace your "Less than a Year" with a 0. This will allow you to use this column to do mathematical operations still.
- A String column that keeps the numbers as strings and allows the value "Less than a Year". This can be used for display purposes.
It would look something like this:
YearsColumn (Number) DisplayColumn (Text) 0 Less than a year 1 1 5 5 - 1 year ago
Thanks for the solution smokeyjoe03
In the "Details" in the error it suggests the value you are trying to change to a number is the string "Less than a Year"
Anything in that column that isn't a numerical value will cause the error when converting it.
- powerbidev1231 year agoSolution Sage
smokeyjoe03 , but i need to keep that "Less than year" value in my column along with the numerical values . How can I go about it?
- smokeyjoe031 year agoFrequent Visitor
The column will have to remain as a string in that case, the "Change Type" operation operates on every value in the column so even just 1 value that isn't a number or NULL will cause the error.
As a workaround I suggest making two columns:- A Number column but replace your "Less than a Year" with a 0. This will allow you to use this column to do mathematical operations still.
- A String column that keeps the numbers as strings and allows the value "Less than a Year". This can be used for display purposes.
It would look something like this:
YearsColumn (Number) DisplayColumn (Text) 0 Less than a year 1 1 5 5 - powerbidev1231 year agoSolution Sage
Thanks for the solution smokeyjoe03