Power BI Query Group Tutorial

In this Microsoft Power BI Tutorial, We will discuss how to create a Power BI Query Group, What are the different ways to create Power BI Query Group, how to add a Table to Query Group in Power BI.

Also, We will discuss how to rearrange Tables in a Power BI Query Groups, How we can delete a Query Group in Power BI and Nested Query Groups in Power BI.

Also, We will see what is the Power BI Group By and I will show you how we can use it with a simple example.

Learn how to export power bi report to excel and how to export power bi reports to pdf.

Create a Query Group in Power BI

First of all, To create a Query Group on existing tables in Power BI, you have to enter in the Edit Queries option. So, click on the Edit Queries option which is present under the Home tab as shown below.

power bi query group

Once you will click on the Edit Queries option, a window will appear which is known as Power Query Editor. You can view all the Tables that are present under the Queries section as like the below screenshot.

create power bi query group 1

Different ways to create Power BI Query Group

There are two different ways to create the Query Group in Power BI which you can see in the below points as:

Approach-1

The first approach to create a new Power BI Query Group, just right-click on the blank space under the Queries section. Select the New Group option from the menu as shown below.

create power bi query group

When you will select the New Group option from the menu, it will open the following window where you have to enter the following required fields as:

  • Name: Enter the name of the new group.
  • Description: Provide a description of the new group.

Once you have specified all the value, just click on OK.

As per my requirement, I have specified my new group name as TSInfo Team and clicked on OK.

how to create power bi query group

Now you can see the new group is created as TSInfo Team as a folder like the below screenshot.

create a query group in Power BI

Approach-2

The second approach to create a new Power BI Query Group, just right-click on the table where you want to create a new Group. Select the Move To Group option and then click on New Group as the below screenshot.

how to create a query group in Power BI

When you will click on New Group, the same window will appear where you have to specify the Group Name and Description.

create query group in Power BI

Add a Table to Query Group in Power BI

In Power BI, If you want to add a table to Query Group, then right-click on the table which you want to add. Select Move To Group and then click on the Group name (as in this example, I have taken TSInfo Team).

how to create query group in Power BI

Now you can view the Employee Details table is present under the TSInfo Team group as shown below.

query group in power bi

Rearrange Tables in a Power BI Query Groups

Suppose you want to view all table names as an ascending or descending order, then, in this case, you can rearrange your all table names by using Move Up and Move Down option.

Let’s take an example. In this below example, I want to move up the table named Sales Revenue. For this, I have right-clicked on the table and selected Move Up option as you can see from the below screenshot.

power bi group by

Now you can see the table Sales Revenue is moved up above the Sales Details table as shown below.

power bi group by measure

Delete a Query Group in Power BI

Suppose you want to delete a query group that is unwanted or unuseful. For that, Right-click on the Query group name and choose Delete Group option from the drop-down.

power query group by

When you will click on the Delete Group option, it will open the following window. If you are sure to delete the Power BI Query Group, then click on the Delete button as shown below.

group by in Power query

Ungroup existing Query Group in Power BI

If you want to ungroup the existing Query Group, then right-click on the Query group name and select the Ungroup option.

power bi group by month

Once you will ungroup the existing group, you can not see that group anymore as you can not see in the below screenshot.

create group by month in Power BI

Nested Query Groups in Power BI

Suppose you want to add a query group inside the other query group, then you can follow the below processes:

  • Right-click on your Power BI Query Group.
  • Select the Move To Group option.
  • Select your Group name where you want to add the group.

As per my requirement, I wanted to add the TSInfo Training Group in the TSInfo Team group.

group by measure in Power BI

Now in the below screenshot, you can see the TSInfo Training Group is present inside the TSInfo Team group.

power bi transform data

Again if you want to undo the group as it is previous, then right-click on that group name and select Move To Top Level option.

power bi edit query group by

Once all things will be over, don’t forget to click on the Close and Apply button which is present under the Home tab as shown below. Because until and unless you will not click on this button, then the changes will not affect in Power BI.

power bi query editor group by

Group By in Power BI

The Group By option helps to group the values in multiple rows into a single value in the Query Editor. You can group by values like total revenues, count of employees, count of products, etc.

To create Group By in Power BI, there are two different approaches are present as:

  • By using the Home tab:

The first approach to create Group By in Power BI, Go to the Home tab and then click on Group By option which is present in the ribbon section as shown below.

Group by in Power BI
  • By using the Transform tab:

The second approach to create Group By in Power BI, Go to the Transform tab (inside the Edit queries button in Power BI Desktop) and then click on Group By option which is present in the ribbon section as shown below.

Group by in Power BI Edit queries

Once you will click on Group By option, it will open the following window where you have to enter some required values as:

  • Group by: Choose any column which you want to be grouped. By default, the Query Editor selected any one column, but you can change it to be any column from the drop-down.
  • New column name: Specify the name of the new column which will display in the Power BI query editor.
  • Operation: Provide some query operations like sum, Count rows, etc, as per your requirement.
  • Add grouping: When you will select the Advanced option, then only you can view this option. By using this option, you can perform the Group by actions on multiple columns.
  • Add aggregation: When you will select the Advanced option, then only you can view this option. By using this option, Query Editor creates a new column (based on your selections in this window) that operates on multiple columns.

Once you will enter all the field values, Just click on OK as the below screenshot.

Group by Query Editor in Power BI

Now in the below screen, you can see the Group By value is displaying in another new column as Count.

power bi group visuals

Also, you may like the below Power BI articles:

Hence in this Microsoft Power BI Tutorial, We discussed how to create a Power BI Query Group, What are the different ways to create Power BI Query Group, how to add a Table to Query Group in Power BI.

Also, We discussed how to rearrange Tables in a Power BI Query Groups, How we can delete a Query Group in Power BI and Nested Query Groups in Power BI.

Also, We will saw what is the Power BI Group By and I have shown you how we can use the Power BI Group By option by taking a simple example.

  • >