How to Group Data in Power BI (Fast & Easy)
Power BI is the winning business intelligence tool by Microsoft. It facilitates data analysis by allowing importing data from multiple data sources.
Grouping data is a powerful feature of Power BI that helps you categorize your data and make more sense of it.
Even if you’re dealing with a large dataset or want to visualize data more effectively, you can group data points to shape it better. Grouping data will reveal data insights and bring out a more structured outlook that you never knew existed before 😲
And if you’re wondering how to do that, let me tell you it takes no more than a few seconds to group/ungroup data in Power BI.
In the tutorial below, I will walk you through grouping data in Microsoft Power BI. Make sure you read until the end.
Note that the feature of grouping data is only available in Power BI Desktop.
Grouping Data in Power BI
When you create a visual in Power BI, it categorizes or groups the data into chunks or groups based on the underlying data.
But sometimes, you might want the data to be differently grouped. Power BI Desktop allows you to group data manually to see and analyze data trends in the visuals more clearly.
Grouping data in Power BI reports is a breeze 💨
To show you how it’s done, I am using the Regional Sales Sample file. It is advisable to download this file on your PC, launch it in Power BI Desktop, and follow me along the way.
I have created a clustered column chart on a new page in the Regional Sales Sample file that I will be using to show you how to group data in Power BI Desktop.
There are two ways how you can group data in Power BI 2️⃣
From this chart, I want to group certain industries.
Here are two ways how you can do this 👇
From the visuals
Under this method, you can directly select the data points that you want grouped and group them.
To start:
Step 1) Click on the bar for the first “Industry” that you want to group 🏢
Step 2) Press down the Ctrl key and click on the bar for the next industry to select it.
This way you can select multiple elements from your visual.
Step 3) Once selected, right-click on any of the selected bars.
Step 4) From the context menu dropdown that launches next, click on Group Data.
Here’s the difference grouping makes to the visual. The grouped industries appear in a different colorthan the ungrouped industries. This tells that the grouped and ungrouped industries form two different legends ⛳
How is that?
Once the grouping is done, you will see a new sub-category added to the relevant field under the Data pane (with a table-like icon). The group will also be added to the Legends bucket for the bar chart.
This method is a quicker method when you’re only looking to create a single group with not a lot of attention focused on naming or editing it.
From the Data Pane
If you want to simultaneously create multiple data groups, this method will be of better use to group and categorize data more effectively 🧾
Step 1) Click on the Data icon on the top right of your Power BI canvas to access the Data Pane.
Step 2) Choose the column of data whose data points are to be grouped.
Step 3) Right-click on this column, and from the context menu, choose “New Group”.
This will take you to the Groups dialog box as below.
Step 4) Set the Group Type to “List”.
Step 5) From the ungrouped values in the right pane of this dialog box, select the values that you want to group by pressing the Ctrl key.
Step 6) Click on the Group button.
This will create a group of the selected values with a name 🔮
Step 7) Double-click on the name of the group to rename it as you like.
Following the steps above, you can create multiple groups from the selected column of data and name them as you like.
Like I have grouped multiple industries under different groups 🥂
Making Changes to Groups
If you’ve created a group and later want to edit it (change, remove, or add new values to the group), you can do the same using the Groups dialog box🖊
To launch it:
Step 1) Right-click on the group’s field.
Step 2) From the Context menu that appears next, click on Edit Groups.
To add a new value to an already created group 👩🏫
Step 3) Select the value from the list of Ungrouped Values.
Step 4) Click on the group where you want to add it.
I want to add the Business Services Industry to Group A, so I have selected them both from the relevant lists.
Step 5) Click on the Group button to group it with the already grouped values.
Power BI will group the new value to the already existing group.
Similarly, to remove a value from an already created group ✂
Step 1) Select the value from the group.
Step 2) Click on the Ungroup button to remove it from the group.
I want to remove the Business Services Industry from Group A, so I have selected it from Group A.
Step 3) Click on the Ungroup button to ungroup it from Group A.
Power BI will ungroup Business Services from Group A.
This is how you can easily make changes to the groups you’ve already created 🤩
Conclusion
Grouping data in Power BI can improve the clarity and impact of your reports. It helps you efficiently categorize your data, see-through trends that were never so evident before, and make your visualizations more meaningful.
Power BI got you so much to learn so, if you’re new to the game (or even if you’re an advanced Power BI user), do not forget to check out the following blogs by Spreadsheeto on similarly amazing features 💪