Skip to content

Instantly share code, notes, and snippets.

@m-dekorte
Last active September 12, 2025 15:02
Show Gist options
  • Select an option

  • Save m-dekorte/09fece0e056e4422f0535b762ec5369f to your computer and use it in GitHub Desktop.

Select an option

Save m-dekorte/09fece0e056e4422f0535b762ec5369f to your computer and use it in GitHub Desktop.
Explore 'Table.TransformColumnTypes' in Power Query M with the optional third parameter now also accepting a Record with Culture and/or MissingField.
let
/* The July 2025 update to the documentation now mentions a MissingField type for Table.TransformColumnTypes */
/* Here's sample data, a table with two columns: Date and Value */
Source = #table(
type table [Date = date, Value = number],
{
{#date(2024, 3, 12), 0.24368},
{#date(2024, 5, 30), 0.03556},
{#date(2023, 12, 14), 0.3834}
}
),
/* Attempt to change column types. */
/* Note: "Customer ID" does not exist in the Source table, */
/* so this step fails. */
ChType_Default = Table.TransformColumnTypes(
Source,
{
{"Date", type text},
{"Customer ID", Int64.Type},
{"Value", Percentage.Type}
}
),
/* Transform column types 3rd parameter accepts a Culture tag as text; "de-DE */
/* Culture affects formatting/interpretation of values such as numbers and dates */
ChType_Culture = Table.TransformColumnTypes(
Source,
{
{"Date", type text},
{"Value", Percentage.Type}
},
"de-DE"
),
/* 3rd Parameter now also accepts a Record that may include a Culture and/ or MissingField. */
/* MissingField.UseNull > Adds missing columns to the output containing null values. */
/* In this case, "Customer ID" is added, filled with nulls. */
ChType_RecordA = Table.TransformColumnTypes(
Source,
{
{"Date", type text},
{"Customer ID", Int64.Type},
{"Value", Percentage.Type}
},
[Culture = "de-DE", MissingField = MissingField.UseNull]
),
/* MissingField.Ignore > Ignores columns that don’t exist in the Source table, */
/* preventing errors by skipping any missing columns. */
ChType_RecordB = Table.TransformColumnTypes(
Source,
{
{"Date", type text},
{"Customer ID", Int64.Type},
{"Value", Percentage.Type}
},
[Culture = "de-DE", MissingField = MissingField.Ignore]
)
in
ChType_RecordB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment