Transform Columns with List.Zip

May-2016-updates-for-Get-Transform-in-Excel-2016-and-the-Power-Query-add-in-4-1.png

This post continues series of articles about M Function List.Zip ( first postsecond post).

Table.TransformColumns is another function that requires list of pairs if you want to transform several columns in Power Query

111517_1250_transformco1

When we want to transform all fields we can simply use

Table.TransformColumns(#"Changed Type", {}, Text.Trim) 

However, when we need to change only part of the table we have to generate list of pairs {column name, function}.

Text.Trim highlighted in last sample is a good example of transformation function.

In general, transformation function can contain any logic and can transform objects of any type.

If you have column with nested lists or nested tables – no problem.

For example, let’s build a function that capitalize values in cells only when we have exclamation mark in text

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s