How to Group By in Power BI

Cody Schneider8 min read

Summarizing your data is one of the fastest ways to find meaningful insights, and Power BI’s "Group By" feature is the perfect tool for the job. This function lets you condense thousands of rows of raw data into a clean, aggregated summary table. This article gives you a step-by-step walkthrough of how to use Group By to transform your data for clearer analysis.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

What is Group By and Why Should You Use It?

Imagine you have a spreadsheet with thousands of individual sales records. Each row lists a product, the sales amount, and the region where it was sold. While this detailed data is valuable, it's hard to see the big picture. You can't easily answer questions like, "Which region is our top performer?" or "What is our average sale amount per product category?"

This is where "Group By" comes in. The Group By operation lets you take a column (like "Region") and condense all the identical entries into a single row. At the same time, you can perform a calculation — or aggregation — on another column for that group. For example, you can take all the rows for the "North" region and sum up their sales amounts into a single, total figure.

Using Group By allows you to:

  • Summarize large datasets: Turn thousands of rows into a concise summary table.
  • Perform calculations on categories: Calculate sums, averages, counts, minimums, or maximums for specific groups.
  • Prepare data for visualization: Create the aggregated tables needed to build meaningful charts and graphs, like a bar chart showing total sales per region.

Essentially, it’s a foundational step in data preparation that turns messy, granular data into clean, report-ready information.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Accessing the Group By Feature in Power Query

The "Group By" transformation happens in the Power Query Editor, which is Power BI’s data preparation area. To get there:

  1. On the Home ribbon in the main Power BI Desktop window, click on Transform data.
  2. This will launch the Power Query Editor in a new window, where you can see all of your data tables.

Once you’re in the Power Query Editor, you can find the Group By feature in two places:

  • In the Transform tab on the ribbon.
  • By right-clicking the header of the column you want to group by. This is often the quickest method.

A Step-by-Step Guide to Using Basic Group By

Let's walk through a simple, practical example. Imagine we have a sales table that looks like this:

Our goal is to find out the total sales for each Region. Here’s how to do it.

Step 1: Open the Group By Window

In the Power Query Editor, right-click on the header of the column you want to group your data by. In our case, this is the Region column. From the dropdown menu, select Group By...

Step 2: Configure the Group By Operation

The "Group By" dialog box will appear. Because we started by right-clicking the "Region" column, Power BI has already pre-selected it as the column to group by.

Now, we need to tell Power BI what to calculate for each group.

  • New column name: Give your new aggregated column a descriptive name. Let's call it Total Sales. This is the column that will hold the result of our calculation.
  • Operation: Choose the calculation you want to perform. You can choose from Sum, Average, Median, Min, Max, Count Rows, and more. Since we want total sales, we'll select Sum.
  • Column: Select the column you want the operation to be performed on. We want to sum the sales figures, so we will select the Sales column from the dropdown list.

Step 3: Apply the Changes

Click OK. Power Query will now transform your table. The original table with many rows will be replaced by a new, summarized table. It will have just two columns: Region and our newly created Total Sales, showing the sum of sales for each unique region.

That's it! In just a few clicks, you’ve answered a core business question by condensing a large dataset into an actionable summary.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Using the Advanced Group By Option

Sometimes a single grouping and calculation isn't enough. What if you wanted to see the total sales and the number of sales transactions for each region? Or what if you needed to group by both Region and Product Category? For this, you need the "Advanced" option.

Adding Multiple Aggregations

Let's build on our previous example. We want to find the total sales and the total number of orders for each region.

  1. Right-click the Region column and select Group By...
  2. At the top of the dialog box, select the Advanced radio button.
  3. The first grouping and aggregation are already set up from our basic view. We'll leave the first aggregation as is (calculating Total Sales by Summing the Sales column).
  4. Click the Add aggregation button. A new row will appear.
  5. For this new row, set the fields as follows:

Click OK. Your table will now show the Region, the Total Sales for that region, and the total Number of Orders for that region.

Grouping By Multiple Columns

Now, let's take it one step further. What if we want to see the performance of each Product Category within each Region? This requires grouping by multiple columns.

  1. Open the Group By window again (you can do this by clicking the gear icon next to the "Grouped Rows" step in the "Applied Steps" pane on the right).
  2. Ensure you are in the Advanced view.
  3. Under the grouping section, click the Add grouping button.
  4. In the new dropdown that appears, select Product Category.

You can still keep your aggregations for Total Sales and Number of Orders. When you click OK, Power BI will produce a table grouped by every unique combination of Region and Product Category, along with the corresponding calculations.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Good to Know: Power Query vs. DAX Functions

If you've spent any time with Power BI, you've probably heard of DAX (Data Analysis Expressions). DAX has its own functions for grouping data, like SUMMARIZE and GROUPBY. So what’s the difference?

  • Power Query (Group By): Transformations you make here, including Group By, physically change the table in your data model. You are shaping and preparing the data before it gets loaded into your report for analysis. This is best for permanent, large-scale summarization that you want applied to your model.
  • DAX (SUMMARIZE, etc.): DAX functions are used within measures and calculated tables in the report view. They create virtual tables on-the-fly and don't permanently alter your model's underlying tables. This is best for dynamic calculations needed for specific visuals or measures.

For most data preparation and cleaning tasks, using Group By in Power Query is the standard and recommended approach. It simplifies your data model, which can improve report performance.

Tips for Effective Grouping

Keep these points in mind to avoid common issues:

  • Grouping removes other columns: A key thing to remember is that the Group By operation gets rid of any columns that are not part of the grouping or an aggregation. Your new table will only contain the group-by columns and the new aggregation columns you created. If you need other columns later, make sure you don't need them or consider merging them back in after grouping.
  • Check your data types: Make sure the column you are aggregating has a numerical data type (like Whole Number or Decimal). You can't perform a "Sum" on a text column.
  • "Count Rows" vs. "Count Distinct Rows": "Count Rows" gives you the total number of transactions in a group. If you want to count unique items (like how many different customers purchased in a region), you would choose the aggregation "Count Distinct Rows" and apply it to the customer ID column.

Final Thoughts

The "Group By" feature in Power BI is a workhorse for data transformation, allowing you to quickly summarize massive tables into insightful, digestible reports. By mastering both its basic and advanced capabilities, you can efficiently prepare your data models and uncover the bigger picture hidden within your raw data.

While Power Query is powerful, it does come with a learning curve. For teams that want to get answers without clicking through menus or learning an interface, new AI-powered tools provide a more intuitive path. At Graphed, we’ve built an AI data analyst that lets you create these kinds of aggregated reports using simple, plain English. You can just ask, "Show me a chart of total sales by region for last quarter," and our tool instantly connects to your data, performs the grouping, and builds the visualization for you in seconds — no Power Query required.

Related Articles

How to Enable Data Analysis in Excel

Enable Excel's hidden data analysis tools with our step-by-step guide. Uncover trends, make forecasts, and turn raw numbers into actionable insights today!