Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
algorton
Frequent Visitor

Comparing versions with multiple decimal points

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):

 

algorton_0-1687863002974.png

 

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

1 ACCEPTED SOLUTION
collinsg
Super User
Super User

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.

View solution in original post

2 REPLIES 2
collinsg
Super User
Super User

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)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.