Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Good morning
I am trying to run a comparision to check if the operating system version of my mobile devices is compliant. I was thinking of running Power Query e.g.
if [operatingSystem] = "Android" and [osVersion] <=10
then "TRUE"
else if [operatingSystem] = "iOS" and [osVersion] <15
then "TRUE"
else if [operatingSystem] = null or [osVersion] = null
then "Unknown"
else "FALSE"
My data is obviously in the incorrect format so the idea was to convert to decimal (I only need the major version number to do a comparison):
When converting the column to decimal I see the following error: DataFormat.Error: We couldn't convert to Number.Details: 5.1.1.
Obviously the multiple decimal points seem to be causing a problem; numbers with a single decimal point e.g. 7.0 convert with no issue. It would be appreciated if anyone could provide me some ideas on how I can achieve this comparision.
Thanks
Solved! Go to Solution.
Good day @algorton
The Text.BeforeDelimiter function may be used to extract text before the first "." (if there is no "." it will simply return the text). In the following code replace #"Previous Step" with the name of your previous step.
= Table.TransformColumns(
#"Previous Step",
{{"osVersion", each Text.BeforeDelimiter(_, "."), type text}}
)
After this you can change the column type to whole number.
Hope this helps.
Good day @algorton
The Text.BeforeDelimiter function may be used to extract text before the first "." (if there is no "." it will simply return the text). In the following code replace #"Previous Step" with the name of your previous step.
= Table.TransformColumns(
#"Previous Step",
{{"osVersion", each Text.BeforeDelimiter(_, "."), type text}}
)
After this you can change the column type to whole number.
Hope this helps.
@collinsg thanks very much for your input; the code below worked perfectly for me.
= Table.AddColumn(#"Expanded ownerTypes", "osVersion_Decimal", each Text.BeforeDelimiter([osVersion], "."), type text)
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
9 | |
9 | |
7 | |
6 | |
6 |