New Tool Radar

AI for Data & Spreadsheets

How to Check Column Data Types in a Power Query After a Refresh

Check that column data types in a Power Query stay correct after a refresh.

Schematic with three steps: Refresh and read the type icon on; Find the rows that changed the type; Set the type explicitly and re-check after.

Power Query guesses each column’s type from the first rows of data, and a refresh with new data can change that guess: a column that was numbers can become text when a new row holds a word, and dates can become text when a new row holds a different format. The loaded table then sorts, filters and sums wrongly, with no error to warn you. Check the type icons after every refresh.

What you need

  • The workbook with the Power Query
  • The expected type of each column: number, date or text
  • A copy of the workbook to test the refresh in

Step 1: Refresh and read the type icon on each column

Refresh the query, open the Power Query Editor, and read the small icon at the left of each column header: ABC for text, 123 for numbers, and a calendar for dates. Compare each icon with the type the column should have.

Step 2: Find the rows that changed the type

For any column whose type is wrong, sort or filter it to find the new rows that do not fit the type, such as a word in a number column or a date in a different format. Note the row and the value.

Step 3: Set the type explicitly and re-check after refresh

Add a Changed Type step that sets the type you want, using the column header menu, and move it to the end of the steps if it is not already there. Refresh again and confirm the icons are right.

Worked example: synthetic amount column after refresh

The table below is a synthetic example. It shows the expected result of checking data types after a refresh; no query was run.

Check Value Result
Columns in the query 5 Source
Amount column type before refresh Number Correct
Amount column type after refresh Text Changed by new data
Cause found One row holds N/A Text in a number column
Type after explicit Changed Type step Number Correct again

Expected result (UNTESTED). after a refresh, the Amount column changes from Number to Text because one new row holds the text N/A; setting the type explicitly with a Changed Type step restores the Number type. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • Automatic type detection reads only the first rows, so a bad value further down can change the type on refresh.
  • Changing a type can turn values into errors instead of converting them; read the error rows before loading.
  • A date column read as text will sort alphabetically, putting 1 April before 10 January.
  • Setting the type in the source file does not set it in the query; the query needs its own Changed Type step.

Sources

See all