each
Shorthand for a function with one parameter named _. each [Qty] * 2 means (_) => _[Qty] * 2.
each is used wherever a function takes another function: filter conditions, custom columns, transforms. Inside it, [Column] reads a field of the current row because it's short for _[Column]. Without each, M looks for a value called _ that doesn't exist and raises an error.
In the Power Query editor
Dialogs such as Filter Rows and Custom Column generate each expressions; you see them in the formula bar.
Learn more
Practise it
- advanced~12 minPro
Write a shipping-cost function and apply it (kite shop)
Define a function that prices shipping from quantity and region, then add a Shipping column with it.
- intermediate~9 minPro
Write a tax function with an optional rate (shop)
Define Gross(net, optional rate) that uses 20% when no rate is given, and apply it to every order.
- advanced~12 minPro
Add a running total in date order (consultancy)
Sort claims by date, then add a Running Total of Amount from the first claim to each row.
- advanced~10 minPro
Trim every column except Amount with one generated step (members)
Text columns are padded with spaces, and new ones keep appearing. Build the Table.TransformColumns list from the column names.