Forum Discussion

Jaweed's avatar
Jaweed
Icon for Helper III rankHelper III
2 years ago

Show Either Total or Average in Matrix Total

Hi Friends

I am seeking your valuable assistance.

 

I am able to design a matrix in powerbi, with totals showing properly at required hierarchy levels. My problem is that for some columns, I need to do a SUM in the Total row,  while for others I need to calulate the average instead. Examples, for Revenue it makes sense to get the Total while for % Profit, the 'Total' should show the AVERAGE of the rows.

I attach a sample Test data with the desired output of the matrix. In the sample data, when column [Unit of Measure] = Units, I need to sum, when the column = %, then I need to average. 

Thank you for your help. 

 

CompanyMonthMetricValueUnit of Measure 
CPYA24-JanRevenue20000Units 
CPYA24-Jan% Profit60% 
CPYA24-JanNo of Complaints3Units 
CPYA24-Jan% Leavers6% 
      
CPYB24-JanRevenue25000Units 
CPYB24-JanPercentage  Profit30% 
CPYB24-JanNo of Complaints6Units 
CPYB24-Jan% Leavers4% 
      
      
CPYA24-FebRevenue10000Units 
CPYA24-Feb% Profit20% 
CPYA24-FebNo of Complaints2Units 
CPYA24-Feb% Leavers8% 
CPYB24-FebRevenue12000Units 
CPYB24-Feb% Profit10Percentage 
CPYB24-FebNo of Complaints1Units 
CPYB24-Feb% Leavers2% 
      
      
Desired output in Matrix     
  Revenue% ProfitNo of Complaints% Leavers
Consolidated 6700030125
CPYA24-Jan200006036
 24-Feb100002028
 Total/Average300004057
CPYB24-Jan250003064
 24-Feb120001012
 Total/Average370002073
      
Grand Total 6700030125