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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
akhaliq7
Post Prodigy
Post Prodigy

id column type text convert to number (query folding)

I have pulled in a table from a database which makes the id column a text data type automatically. This makes my data load slower than my other tables that have a number as their id column. What would anyone suggest I do leave it as it is, break my query folding as the last step in power query and change the data type to a number or is there anything else I can do?

 

FYI: My queries are also using query folding.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @akhaliq7 ,

 

Did you use Power BI Desktop to connect data? Try to select 'Detect column types and headers for unstructured sources according to each file's setting' in the options.

3.png

 

Best Regards,

Stephen Tao

 

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

7 REPLIES 7
Anonymous
Not applicable

Hi @akhaliq7 ,

 

Did you use Power BI Desktop to connect data? Try to select 'Detect column types and headers for unstructured sources according to each file's setting' in the options.

3.png

 

Best Regards,

Stephen Tao

 

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

Anonymous
Not applicable

Instead of using the default type change, try using Table.TransformColumns instead of Table.TransformColumnsTypes.

 

=Table.TransformColumns(#"Replace Value", {{"Id", Number.From}})

 

You could also try Int64.From instead of Number.From.

 

--Nate

I tried this and it still breaks the query folding. 

akhaliq7
Post Prodigy
Post Prodigy

When i convert my text column to a decimal number it still breaks my query folding

id_text.PNG

When i right click on the changed type step the view native query is greyed out

BA_Pete
Super User
Super User

Hi @akhaliq7 ,

 

No reason why changing this field to a number should break query folding, just make sure to change it to Decimal type, NOT Whole Number type.

 

Pete



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

Proud to be a Datanaut!




Hi @BA_Pete 

Could you please explain why we shouldn't change it to a Whole Number type ?

Thanks

 

Because Int64.Type isn't recognised by SQL Server for query folding unless you use the [UnsafeTypeConversions = true] argument. As this suggests, it's potentially unsafe and, therefore, not a recommendation I'd generally make to users on here.

 

If it's something you really want/need to do, then I'd suggest reading Chris Webb's methods here, and understand the risks:

https://blog.crossjoin.co.uk/2021/06/29/data-type-conversions-for-sql-server-sources-and-query-foldi... 

 

Pete



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

Proud to be a Datanaut!




Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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