Stop the auto Changed Type step in Power Query

Power Query in Excel and Power BI has an annoying default feature that automatically applies the Changed Type step even if we don’t want it. It generally occurs when creating new queries from non-database sources, but it also appears after some basic transformations.

In this post, I want to show you how to stop the automatic Changed Type step in Power Query.

Table of Contents

Watch the video


Watch the video on YouTube.

Why is Changed Type a problem?

Changing data types in itself is a good thing. By defining data types, we tell Excel what calculations it can perform on each column. However, if not used at the correct point in our query, it can cause problems.

Let’s take a brief look at some of those problems.

Changing column names

If the Changed Type step is applied automatically on query creation, it is usually the first step explicitly referencing the column headers. Therefore, if our column names change, it will trigger an error on refresh. So, that isn’t good!

Creates unnecessary steps

If we have already defined the data type for a column, some transformations will trigger another change in data types.

For example, if we have a text column with the correct data type applied, splitting by a delimiter will add an additional (and unnecessary) Changed Type step.

Changed Type doesn’t always get it right

The automatic Changed Type transformation is based on Power Query’s assessment of the first 200 rows of data.

If we have an alphanumeric column, it should be treated as text. However, Power Query may decide it should be a whole number if no letters are found in the first 200 rows. This will also result in an error.

Also, just because something is numeric does not mean it should be a numeric data type. For example, references or anything containing leading zeros should be treated as text to ensure their value is correctly maintained. Yet, Power Query will often change these to numeric data types.

Inefficient refresh time

The order of steps affects the efficiency of a query. For example, if we have 1,000,000 rows of data and we want to filter on a single value which reduces the data to 100 rows. It is faster to apply the filter first, then change type on 100 records, rather than changing type on 1,000,000 rows then filtering.

It will be negligible for many datasets, but let’s not add additional delay into the process.

Often needs to be deleted manually

Because of the issues noted above, I find myself deleting the Changed Type step in most circumstances. Therefore, this adds extra manual effort.

How to stop the automatic Changed Type step?

To turn off the automatic Changed Type step in Power Query (this is the same in Excel and Power BI):

  • Within the Power Query Editor, click File > Options and Settings > Query Options
  • In the Global Data Load section, we have 3 options:
    Query Options Window
  • Select the 3rd option, Never detect column types and headers for unstructured sources, to stop the automatic application of the Changed Type step
  • If you want to decide on a Workbook by Workbook basis, select the 2nd option, Detect column types and headers for unstructured sources according to each file’s setting.
    To apply the setting for each Workbook, go to the Data Load from the Current Workbook section, uncheck the Detect column types and headers for unstructured sources option.
    Query Options Window - Workbook setting

Conclusion

See, all it takes is one simple setting, and we are now much more efficient. Of course, we still need to change types, but now we can decide when this happens.

If you want to know more about working with Power Query?


Discover how you can automate your work with our Excel courses and tools.

Excel Academy

Excel Academy
The complete program for saving time by automating Excel.

Excel Automation Secrets

Excel Automation Secrets
Discover the 7-step framework for automating Excel.

Office Scripts Course

Office Scripts: Automate Excel Everywhere
Start using Office Scripts and Power Automate to automate Excel in new ways.

2 thoughts on “Stop the auto Changed Type step in Power Query”

  1. Great post indeed. Very useful to know these details on the behaviour of the EXCEL Power Query and how to modulate it.
    Thanks.

    Reply

Leave a Comment