Power BI: calculate values by group
I have this table:
And I want to sum values for each group, in my example, the parent tickets. To do it, I will use this formula:
IF(NOT(ISBLANK('table'[argument1])),SUMX(FILTER('table',EARLIER('table'[argument1])='table'[argument1]),'table'[argument2]))
Now if I want to have the results to be in the same row as the matching value of the “number” column, I have 2 options, one with a new table and one without.
Option 1 without a new table
With a new column, I will use this formula:
SUMX(FILTER('table',EARLIER('table'[argument3])='table'[argument1]),'table'[argument2])
Option 2 with a new table
I will create a new table called “table2” by extracting the “number” and “parent” columns without the empty cells like that:
NOTE: to know how, read Power BI: extract columns from a table to another one.
In the “table1”, I will create a new column with this formula:
LOOKUPVALUE('table2'[argument1],'table2'[argument1],'table1'[argument3])
And this last one:
IF(NOT(ISBLANK('table1'[argument4])),SUMX(FILTER('table1',EARLIER('table1'[argument4])='table1'[argument1]),'table1'[argument2]))
NOTE:
- Based on your data, change SUMX by COUNTX or AVERAGEX
- For combining values, read Power BI: match values between 2 columns then concatenate
Interesting Topics
-
Be successfully certified ITIL 4 Managing Professional
Study, study and study, I couldn’t be successfully certified without studying it, if you are interested...
-
Be successfully certified ITIL 4 Strategic Leader
With my ITIL 4 Managing Professional certification (ITIL MP) in the pocket, it was time to go for the...
-
Hide visual and change background color based on selection
Some small tricks to customize the background colour of a text box...
-
Stacked and clustered column chart or double stacked column chart
In excel, I use a lot the combination of clustered and stacked chart...
-
Refresh Power BI
From the Power BI Service, I can set refresh but, for instance, there is no option to do it monthly or each time a change is made...
-
Power BI alerts to be sent by email from an excel file based on condition
I will explain how to send a list of emails from an excel file after creating alerts...






