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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

DataFormat Error: We Couldn't convert to Number

Hi,

I am getting this error when I try to sort a True/False Column in Descending order

[DataFormat.Error] We couldn't convert to Number.
Details:
   O

When I filter the field, all I see is True/False on the field.

Thanks

-w

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

You can refer the following link to update the formula of custom column as below:

Error handling

=try Value.Is(Number.From(Text.Range([myfield],3,1)),type number) otherwise false

yingyinr_1-1662519913973.png

Best Regards

View solution in original post

6 REPLIES 6
HotChilli
Super User
Super User

Can you provide some data that does not show an error when the 4th character is not a number (so a text value that does not error)? 

I would expect the Number.From to throw an error for any text value that won't convert to number.

There are ways to deal with this but maybe you can provide the example first.

Anonymous
Not applicable

Thanks Chilli,

I can't -- it is proprietary. I rolled through all the other rows that are false.
In each instance, the 4th char is a space. So it seems if the 4th character is a space, the formula is safe to use as is.

Thanks

-w

Anonymous
Not applicable

Thanks Amichandak,

I found this good article on DataFormat Error here.
I started following the steps
I see what is causing a problem where a string has an O (not a zero(0)) in the 4th position
What I do not understand:
I think my Power Query Inspection formula should handle the string and simply return a true or false -- not an error.

Formula:
Value.Is(Number.From(Text.Range([myfield],3,1)),type number))

I am only getting the 1 error, so the formula is working for all other instances where sometimes the 4th character is a number, sometimes not.

Thanks

-w

Anonymous
Not applicable

Hi @Anonymous ,

You can refer the following link to update the formula of custom column as below:

Error handling

=try Value.Is(Number.From(Text.Range([myfield],3,1)),type number) otherwise false

yingyinr_1-1662519913973.png

Best Regards

Anonymous
Not applicable

Thanks Rena - perfect!

Thanks,

-w

amitchandak
Super User
Super User

@Anonymous ,The information you have provided is not making the problem clear to me. Can you please explain with an example.

Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors