I have a column with coordinates in this format POINT(2.150423 48.786381). I want extract latitude and longitude because otherwise i can't see my points in the Map.
I tried the following m and DAX codes but it doesn't work even though i have a float in return. I dont understand.
= try Number.FromText(Text.Trim(Text.BetweenDelimiters([geo], "POINT(", " "))) * 1.0
m Error : Sorry... we cant proceed to the conversion into a number
= try Float.From(Number.FromText(Text.Trim(Text.BetweenDelimiters([geo], "POINT(", " "))))
m Error : Float.From wasn't recognised
LatitudeFloat =
VAR startPoint = FIND(" ", 'Table'[geo], 1, LEN('Table'[geo]))
VAR latitudeText = MID('Table'[geo], startPoint + 1, LEN('Table'[geo]) - startPoint)
RETURN
IF(
ISBLANK(latitudeText),
BLANK(),
VALUE(
SUBSTITUTE(
SUBSTITUTE(latitudeText, ")", ""),
",", "."
)
)
)
Dax error : impossible to convert value « 48.782894 » of type text into number
I would use power query to clean the column. I would extract the text between delimiters
Then, I would split the column by the ' ' delimiter. Then you should be able to change the datatypes to numeric. (You may need to trim before that step if you're having problems.)
Lastly, after the data is loaded, assign the lat and long as their proper categories in the Data category back in Power BI Desktop