Power BI sum group by multiple columns

8/10/2021


Here we will see two examples on Power BI sum group by multiple columns and Power BI sum group by two columns.

Here is the sample data we are going to use to solve this problem.

Here we will combine column1 by commas and sum the column2 based on column 3. So, it will show A,B,C(column1) 114(column2) XX(column3)

For this, we will create a calculated table by using Power BI Dax.

  • To create a new table, Click on the Modelling -> New table.
  • Then write the DAX formula:

Combined =

SUMMARIZE (

    'Table',

    'Table'[Column3],

    "Column1", CONCATENATEX ( 'Table', 'Table'[Column1], "," ),

    "Column2", SUM ( 'Table'[Column2] )

)

In the below screenshot, you can see the power BI sum group by multiple columns.

Power BI sum group by two columns

Here we will see the Power BI sum group by two columns using power query in power BI desktop.

We will use the below sample data to find the sum group by two columns in power BI desktop.

We will sum up the values based on WO# and group them by serial using power query.

  • In Power BI desktop click on the Transform Data from the ribbon, to open power query editor.
  • In power query editor, Click on Transform tab -> Group by.

  • Now Group By window will open, then select the Advanced option.
  • From the dropdown select Serial. Next click on Add Grouping.
  • Then from the dropdown select WO#.
  • Change the name of the column to SumOfValue, by default it is count.
  • Then change the to to aggregation Sum from the dropdown list.
  • Select the aggregation column, here it is value column.
  • Click on OK.

In the below screenshot you can see the power BI sum group by two columns using power query

In this power BI tutorial, we learned power BI sum group by multiple columns. And also we discussed the below points power BI sum group by two columns using power query.

 

Source: www.enjoysharepoint.com