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

Join 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.

Reply
mrreisinger
Frequent Visitor

DataFormat.Error: We couldn't convert to Number - for columns with text and numerical values

I'm running into issues when I refresh my data and my tables have columns where I occusionally get the error "DataFormat.Error: We couldn't convert to Number."  I'm assuming this is because 98% of the data is in number format (1,2,3, etc) as salary table codes or maybe retirement codes, etc however there are also codes listed in such as M120 or KF or some other code that isn't numerical.  That is usually where I get the error.  I've tried changing the whole column to Type Text and doesn't work.  I also saw a post to change to Type Any and that doesn't work either.  Any suggestions for the column to read both text and numerical?  And before anyone asks, no, I can't change the data to make it equal another numerical value since that specific text value means a certain retirement type or salary table code or such.  I've been trying to get this worked for weeks now with no success, any ideas?

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @mrreisinger ,

I create a sample to reproduce your problem, here's a sample.

After load the table, the Power Query automatically recognizes that the data type of the column is text.

vkalyjmsft_0-1652424018264.png

After I change the data type to number, it cause errors. This is easy to understand, because A1, A2 cannot be converted to numeric type.

vkalyjmsft_1-1652424214476.png

But now I convert it to text type again, it is still error!

vkalyjmsft_2-1652424509089.png

You should delete the error steps in APPLIED STEPS, and then do other operations. Here's a similar thread for your reference.

vkalyjmsft_3-1652424769435.png

 

Additionally, you can catch an error with try and otherwise  expression, refer to this document: 

Error handling for Power Query connectors - Power Query | Microsoft Docs

iferror-in-power-query-using-try-otherwise

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yanjiang-msft
Community Support
Community Support

Hi @mrreisinger ,

I create a sample to reproduce your problem, here's a sample.

After load the table, the Power Query automatically recognizes that the data type of the column is text.

vkalyjmsft_0-1652424018264.png

After I change the data type to number, it cause errors. This is easy to understand, because A1, A2 cannot be converted to numeric type.

vkalyjmsft_1-1652424214476.png

But now I convert it to text type again, it is still error!

vkalyjmsft_2-1652424509089.png

You should delete the error steps in APPLIED STEPS, and then do other operations. Here's a similar thread for your reference.

vkalyjmsft_3-1652424769435.png

 

Additionally, you can catch an error with try and otherwise  expression, refer to this document: 

Error handling for Power Query connectors - Power Query | Microsoft Docs

iferror-in-power-query-using-try-otherwise

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

HotChilli
Super User
Super User

Reading the post reminds me of a recent one where someone was trying to fix an error by changing the data type 'after' the error has occurred. It can't be done.

If this is the situation, find the step which converts the data to number and delete it (or edit it if you have the skill) and replace it with the change to text type.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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