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

Top Solution Authors