BLOGS BY TOPIC
BLOGS BY AUTHOR
BLOGS BY YEAR
Posted by Sam Lowrie on 20 July 2018
You need a minimum screen resolution of about 700 pixels width to see our blogs. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.
Preventing automatic grouping in Power BI Desktop
For those new to aggregation in programmes other than Excel, it's worth noting what happens when using aggregates in visuals in Power BI. To demonstrate this, consider this table:
A simple table listing the number of products sold in each store.
Everything looks fine at first glance, although Arndale Centre looks a bit of an outlier. Maybe it is in London? Let's check the towns these centres belong to:
Uh oh! Turns out that there are several centres called Arndale Centre - Power BI has grouped the sales to centres of the same name.
You can see what's going on more clearly if you count how many times each Centre appears:
Each centre has its own row in the table, so we can check if the same name appears multiple times.
Creating or using a unique centre identifer
The easiest way to fix this problem is to use a unique identifier for each centre within the table visual to split up centres with the same name. We already have a unique column called CentreID:
Make sure to un-aggregate the column by choosing Don't Summarize, otherwise Power BI will try to SUM or COUNT it.
If you don't have a nice ready-made column to hand, not to fear. We can add one pretty easily in Query Editor. First click this button:
The Edit Queries button on the Home tab.
We could do a similar thing by using the RAND or RANDBETWEEN functions in a calculated column.
Select the table you want to add the new unique column to (for us it is the Centre table). Then choose Index Column from the Add Column tab:
It is never recommended to use From 0 unless you have a good reason to do so!
Using the unique identifier to suppress grouping
You can now use your new column to stop the aggregation of centres with the same name:
Remember to change the aggregation to Don't Summarize, or all your hard work will be for naught!
If you don't want to see the column simply drag the column width so small you can't see it, just like you would in Excel:
You will need to turn Word wrap off for both the Column headers and Values, or risk getting really long column headers!