MissingField.Ignore

Updated on

MissingField.Ignore (1) is an enumeration that specifies the expected action for missing values in a row that contains columns less than expected. It is a member of the MissingField.Type and represents an optional parameter in record and table functions indicating that missing fields should be ignored.

Examples

Let’s walk through an easy-to-understand scenario with the MissingField.Ignore enumeration in the Power Query M Language. Consider this dataset.

Missingfield.Type dataset

You’re deciding which columns are useful and Table.SelectColumns lets you handpick the columns you need.

Table.SelectColumns with a missing column

When you select a column name that does not exist in the dataset, Power Query throws an error.

Missingfield.Type demonstrating Table.SelectColumns

The default behavior of Power Query is to use the MissingField.Error enumeration. You can also explicitly tell Power Query to ignore any missing columns using MissingField.Ignore. The function will simply skip the missing column and return the available ones.

Missingfield.Type returning Missingfield.Ignore
= Table.SelectColumns( Source, {"Name", "Year"}, MissingField.Ignore )

In this instance, we’re selecting “Name” and “Year” from the source table. If these columns aren’t there, Power Query will ignore them, preventing the query from breaking and returning an error. It’s a useful safety measure. Just make sure you know what you’re signing up for. Adding this enumeration prevents you from knowing whether columns have been wrongly removed.

Other related enumerations are:

Applies to

Here’s a list of functions that work with MissingField.Type:

Contribute » | Contributors: Rick de Groot