๐Ÿ”„ Power Query example

Group by examples in Power Query

Learn practical Power Query Group by examples with M code, UI steps, common mistakes, FAQs and copy-ready transformation patterns.

Updated 2026-06-125 practical examplesCopy-ready M code

๐Ÿ’ก Ideas for You

Learning resources for Power Query, data cleaning and repeatable reporting.

4 useful links

Some links in this section may be affiliate links. Choose only what is useful for your own work.

When to use this Power Query pattern

Use this pattern when the same data preparation step needs to happen every time a file, table or report refreshes.

Syntax or pattern

Table.Group(Source, {"Region"}, {{"Total Sales", each List.Sum([Sales]), type number}})

Typical UI steps

  1. Select the grouping column.
  2. Choose Group By.
  3. Add aggregations such as Count Rows or Sum.
  4. Rename summary columns.
  5. Check totals before loading.
โœ๏ธ

5 practical examples

1

Use Group by in a sales report

This example shows how to use Group by when preparing a sales report.

Table.Group(Source, {"Region"}, {{"Total Sales", each List.Sum([Sales]), type number}})

Use this pattern when the sales report needs a repeatable transformation instead of manual cleanup.

2

Use Group by in a customer list

This example shows how to use Group by when preparing a customer list.

Table.Group(CleanSource, {"Department"}, {{"Total Amount", each List.Sum([Amount]), type number}})

Use this pattern when the customer list needs a repeatable transformation instead of manual cleanup.

3

Use Group by in a inventory export

This example shows how to use Group by when preparing a inventory export.

Table.Group(Inventory, {"Region"}, {{"Total Units", each List.Sum([Units]), type number}})

Use this pattern when the inventory export needs a repeatable transformation instead of manual cleanup.

4

Use Group by in a monthly dashboard

This example shows how to use Group by when preparing a monthly dashboard.

Table.Group(ReportData, {"Region"}, {{"Total Revenue", each List.Sum([Revenue]), type number}})

Use this pattern when the monthly dashboard needs a repeatable transformation instead of manual cleanup.

5

Use Group by in a operations tracker

This example shows how to use Group by when preparing a operations tracker.

Table.Group(Tracker, {"Region"}, {{"Total Hours", each List.Sum([Hours]), type number}})

Use this pattern when the operations tracker needs a repeatable transformation instead of manual cleanup.

Common mistakes to avoid

  • Applying steps in an order that makes later cleaning harder.
  • Forgetting that step names are referenced by later M code.
  • Not checking row counts before and after transformations.

FAQ

When should I use Group by in Power Query?

Use Group by when the transformation should be repeatable every time the data refreshes.

Can I do Group by from the Power Query interface?

Usually yes. The interface creates the M code for many common transformations, and you can adjust it in the formula bar or Advanced Editor.

Should I edit the M code manually?

Edit M manually when the interface cannot express the pattern clearly, or when you need reusable logic, parameters or cleaner step names.