Ravindra BagaleCourses & study guides Track your progress

Guides

Data Types in Power Query

Data types tell Power Query whether a column is text, a whole number, a decimal, or a date. Wrong types silently break sums, sorts, relationships and leading zeros on PIN codes and phone numbers.

Friends! PIN 411001 becomes 411001 as a number and looks fine — until a code with a leading zero arrives. Why care? Because type is the quiet bug behind “SUM does not work”. How? We fix Amount, PIN, phone and an Indian date on a FreshBasket practice sheet. Icons first, then Using Locale.

Quick answer

Vertical path:

  1. Read column header icons: ABC text, 123 whole number, calendar date.
  2. Amount → Decimal (or Fixed Decimal).
  3. PIN and phone → Text so zeros stay.
  4. Ambiguous dates → Data Type → Using Locale → English (India).
  5. Delete a wrong automatic Changed Type if it guessed badly.
  6. Close & Apply; test SUM and a relationship.

Real example: shop sheet types

PIN Phone Amount OrderDate
411001 9876543210 100 15-01-2025
400001 9123456780 40 02-03-2025

What wrong types do:

  1. PIN as Whole Number — fine for these rows, but "040001" would lose the zero.
  2. Amount as Text — SUM fails or concatenates nonsense; card will not show 140.
  3. OrderDate as Text — no proper date hierarchy; time intelligence stays blank.
  4. After fixing types: Amount sums to 140, dates sort in calendar order, PIN stays text.

Why a type step is needed: Power Query’s automatic Changed Type samples rows and guesses. Guesses are not business rules.

What do I need before this guide?

Before and after (look at the tables first)

Before data types Wrong column types block SUM.

Before

After data types Correct types; sum works.

After

Icons and common choices

Power Query Types Icons Column icons show the type: ABC text, 123 whole number, calendar date. Wrong type breaks sums and relationships. Power Query Types Icons Column icons show the type: ABC text, 123 whole number, calendar date. Wrong type breaks sums and relationships.

Column icons show the type: ABC text, 123 whole number, calendar date. Wrong type breaks sums and relationships.

Power Query Pin Text PIN codes and phone numbers stay Text so leading zeros do not disappear. Power Query Pin Text PIN codes and phone numbers stay Text so leading zeros do not disappear.

PIN codes and phone numbers stay Text so leading zeros do not disappear.

  1. Text — IDs, PIN, phone, product codes with letters.
  2. Whole number — counts, qty when always integer.
  3. Decimal / Fixed decimal — money and averages.
  4. Date / Date/Time — order day for relationships to a Date table.
  5. True/False — flags.
Power Query Locale Date Indian dates often need Using Locale (English India) when automatic detection guesses wrong. Power Query Locale Date Indian dates often need Using Locale (English India) when automatic detection guesses wrong.

Indian dates often need Using Locale (English India) when automatic detection guesses wrong.

Why Using Locale: 02-03-2025 might mean 2 March (India) or 3 February (US). Locale removes the coin flip.

Working with Changed Type

  1. Click the Changed Type step.
  2. If PIN became a number, set it back to Text (or delete Changed Type and set types yourself).
  3. Prefer explicit type steps you renamed: Typed Amount decimal, Typed PIN text.
  4. Errors after conversion mean dirty cells — fix or replace errors before you model.

Mistakes and calm fixes

Symptom Likely cause Fix
SUM grey / wrong Amount still text Set decimal type
Leading zero gone Typed as number Text type
Date sort weird Text dates Date + locale
Relationship fails Type mismatch on key Match types on both columns

Ravindra Bagale's Tip

Interview line: “I set types in Power Query, keep PIN and phone as Text, and use Using Locale for Indian dates.” Got it?

Practice task

  1. Import a sheet with PIN, Amount, and dd-mm-yyyy dates.
  2. Fix all three types.
  3. Prove SUM = expected total on a card.
  4. Note which automatic Changed Type you replaced.

Learn it properly

Course lesson:

Related: Applied Steps · Auto date/time

Got it? Types decide whether sums, dates and PIN codes behave. Set them in Power Query on purpose. Next: Duplicate vs Reference. Let us go ahead.

Frequently asked questions

Why did my PIN lose the leading zero?

The column was typed as a number. Numbers do not keep leading zeros. Use Text.

Whole number vs decimal?

Whole number is integers (order count). Decimal is money and averages.

What is Using Locale?

You tell Power Query which regional date and number style to use when converting text.

Types in Power Query vs model?

Set them in Power Query so every refresh stays clean. Do not rely on fixing types only in the model.

Error cells after type change?

Some values cannot convert (text in an amount column). Fix or replace errors before Close & Apply.

Course lesson?

Data types in Power Query essentials.