Skip to the workspace
Pebellslearn by building
Cleaning Data with Power Query  ›  Lesson

Data Types and Casting

Data Types & Casting 12 minEach column's header icon shows the type Power Query believes it has, and setting types deliberately, including dates read with the right locale, prevents wrong totals, odd sorting and broken relationships.

power bi / Data Types and Casting

Explore each scene at your own pace.

01 · The rule

The rule

Data Types and Casting

Arjun drags Qty onto a card, expecting a total, and Power BI will only count the values or show the first one — never sum them. The column looks like numbers, but Power Query believes it is text. A data type is Power Query's belief about a column, and wrong beliefs cause wrong totals, odd sorting and relationships that refuse to work.

The rule

Read the header icon, then set every type on purpose.

Every column header in Power Query shows an icon for its type:

Icon Type Example value
ABC Text Pune
123 Whole number 4
1.2 Decimal number 27.5
$ Fixed decimal number (currency, four decimal places) 30.00
% Percentage 12%
Calendar Date 5 January 2026
Calendar with clock Date/Time 5 January 2026 09:15
Tick and cross True/False TRUE
ABC123 Any — no type decided anything

Right after it promotes headers, Power Query usually adds a Changed Type step by guessing each column's type from a sample of the top rows. A guess can be wrong when those rows are unusual, so check every column and set types yourself: click the header icon, or use Transform → Data Type.

Changing a type is called casting. Each value is converted separately. When a value cannot be converted, only that cell shows Error (a DataFormat.Error); the other cells convert normally. The text N/A cast to Whole number is a typical example.

Dates need extra care, because the same text means different days in different countries. 05/01/2026 is 5 January in India and 1 May in the United States. Use Change Type → Using Locale, pick Date and English (India), and Power Query reads the text the way the till wrote it.

Why types matter:

  • Text cannot be summed, so a text column of numbers can only be counted or shown as a first or last value.
  • Text sorts character by character, so 10 comes before 9.
  • A relationship needs the same type on both key columns.
Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.