Power BI buckets or containers are useful for creating a range of data, similar to SQL buckets. Let me show you how to create bins in Power BI with an example
For this Power BI bins demo, we will use the SQL data source that we created in our previous article. Therefore, see Connect to the SQL Server article to understand the data source.
Create containers in Power BI
To visually demonstrate these Power BI bins, we'll create a table. As you can see in the screenshot below, we created a simple table by dragging the Product Key and Sales Amount column.
NOTE: I suggest you refer to the article Create a table and format a table to understand the steps required to create and format a Power BI table.
Select the file you want to use as a container and right-click on it to open the context menu. Select the New group menu option.
By clicking on the New group The option opens the following window.
- Name: Specify the name of the Power BI tray
- Countryside: Field or column you used to group
- Group type: List (group) or container.
- Kind of container: There are two options, such as Container size or Number of containers
- Minimum and maximum value: Minimum and maximum value present in the selected fields. Here is the product key.
If you selected Container Type as Container Size, then you need to specify Container Size (Static Number)
Alternatively, if you selected the Container Type as Number of Containers, you must specify the container count. Here, the container size depends on the container count.
Let me select the container size as 20 and click OK. It means that each cube size is 20
Now you can see the newly created container under the Product table.
Let me add that container to this table. In the following screenshot, you can see that the product key value is 220 for keys between 220 and 240
Edit Power BI containers
Select the container you want to edit and right-click on it to open the context menu. Select the Edit groups choice of her
By clicking on the Edit groups The option opens the following window. Use this window to change according to your needs.
Delete containers in Power BI
Select the container you want to delete and right-click on it to open the context menu. Select the Remove option to do it
Click on the Remove to confirm the delete operation.
Create containers in Power BI example 2
To demonstrate the containers, we created a column chart showing the colored sales. This time we create a bin in Sales Amount
Right-click on the Sales Amount and select the New Group option from the context menu. As you can see in the following screenshot, we define the Power BI tray size as 357.2655
Let me add this new Sales Amount tray to the legend section of the column chart.
Let me edit the Power BI tray and change the tray type to Number of trays and the tray count to 3
Now you can see, each bar in the column chart divided by a 3 count container.