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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Moh_Ashraf
Frequent Visitor

How to make select a format for column containing numbers or text?

I have a column contains sometime numbers and other times text, it make error "Data format error, we couldn't convert to number".

i.e: 

Cell 1 > 83

Cell 2 > Open

format column.png

2 ACCEPTED SOLUTIONS

 

You need to make sure you're making the type conversion BEFORE any other conversions take place. It looks like you probably have 'Automatically detect data types' enabled and Power Query has put a conversion step in for you at the start of the query steps just after the source is imported.

Go to the top of your query steps and see if there's a Changed Types step already there. If yes, then select that step, change the type of your column to Text and, when prompted, choose to replace the step, rather than add a new one.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

 

Perfect. Glad that worked for you.

As an aside: Do NOT use Type Any in Power Query. You should always change your columns to explicit data types. It doesn't have to be done at the first step that we're talking about, but you should always ensure that all of your columns have an explicit data type by the end of the query to avoid causing yourself problems when you apply the query to the data model.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

9 REPLIES 9
ZhangKun
Super User
Super User

You need to check if the previous step set the data type of this column to numeric type.

When you use the connector to read data from Excel file, it may guess your data type. If you want to keep all the content, you should manually set it to text type.

techies
Super User
Super User

Hi @Moh_Ashraf in power query , add a custom column 

 

= try Number.From([ColumnName]) otherwise [ColumnName]

Power BI & Microsoft Fabric
PL-300 | DP-600 | DP-700 Certified
BA_Pete
Super User
Super User

Hi @Moh_Ashraf 

 

You need to convert this column to Text type. If you then need to do statistaical functions/comparisons on just the numbers, you will need to use conditional elements in your calculations, something like this:

if try Value.Is(Number.From([YourColumn]), type number) otherwise false
then [YourColumn] * 10
else [column] // or null or whatever you want your escape value to be

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




I changed the data type to text but actually still error.

I changed the data type to text but Actually, still not workingI changed the data type to text but Actually, still not working

Hi @Moh_Ashraf ,
Thanks for reaching out to Microsoft Fabric Community forum.
Based on the screenshot i have done repro from end , i can able to change the data type as expected.


Once you have loaded the data , change the data type to "Text" as per the below screenshot:

 

vaatheeque_0-1742377248718.jpeg


Then Replace vlaues with reuqired data as shown in below :

vaatheeque_1-1742377352266.jpeg
The expected result as here :

vaatheeque_2-1742377389941.jpeg

Note : Ensure Data Type Change is Applied Properly.

If this post was helpful, please consider marking Accept as solution to assist other members in finding it more easily.

If you continue to face issues, feel free to reach out to us for further assistance!


 

I doesn't want to replace value, I need to keep the data as it is even if number or text.

What I meen is I didn't want to make calculations for number cells, I want power BI read the number as a text.

But when I change the column data type to Text, still give the same error in cells that have text "We couldn't convert to number".

 

 

You need to make sure you're making the type conversion BEFORE any other conversions take place. It looks like you probably have 'Automatically detect data types' enabled and Power Query has put a conversion step in for you at the start of the query steps just after the source is imported.

Go to the top of your query steps and see if there's a Changed Types step already there. If yes, then select that step, change the type of your column to Text and, when prompted, choose to replace the step, rather than add a new one.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Yes, thats right,

I found another step for automatic change data type at first,

I found the column that I have a combined text and value is "int64. type" but I changed it to "Type any"

 

Thank you for support

 

Perfect. Glad that worked for you.

As an aside: Do NOT use Type Any in Power Query. You should always change your columns to explicit data types. It doesn't have to be done at the first step that we're talking about, but you should always ensure that all of your columns have an explicit data type by the end of the query to avoid causing yourself problems when you apply the query to the data model.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.