aggregating data in power bi query editor

I have gone through this tutorial

https://powerbi.microsoft.com/en-us/documentation/powerbi-desktop-tutorial-analyzing-sales-data-from-excel-and-an-odata-feed/

and was having some issues at Task 4 - Step 1 that I have somewhat resolved but would like to find a better way to complete the task.

The issue of this is that the title of my graph is Sum of UnitsInStock by ProductName but I just want it to be "UnitsInStock by ProductName".

See image below:

Sum of UnitsInStock by ProductName

I think the issue is that in the tutorial link it has the "UnitsInStock" column is aggregated already (which you can see in the field pane) whereas I had to aggregate the data myself. I think to fix this I just have to aggregate the data in the query editor but I haven't been able to figure out how to do this.

If someone could point me in the right direction that would be great!

Upvotes: 0

Views: 1104

Answers (1)

Mike Honey
Mike Honey

Reputation: 15017

The button you want is Group By - it's on the Home ribbon in the central Transform section.

Select your grouping columns before hitting it, to preload them in the Group By window. I haven't followed that tutorial so you will need to decide what to select. Any column you don't select for Group By or aggregate (see below) will be removed by this Step.

In the bottom section of the Group By window, click the + button to add an aggregation, then choose Sum and choose your column (e.g. UnitsInStock ). You have to type the output column name.

Upvotes: 1

Related Questions