cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Matrix Table: Average in Row and Sum in Column Header

Hi everyone,

I have a matrix table, where I calculate the average per row using a measure. But in the column header, I need to sum the average values. 

Here is an example of what I would like to accomplish:

image.png

The column M_SumOEE * is a measure with the following formula: 

 

M_SumOee = SUM('FactOee'[Oee])

 

Cells with blue background are summarized per shift because I can have multiple records per shifts. OEE per shift is an absolute percentage value, so I need to sum it.

 

Any idea how I can calculate the average of all summarizes values (blue background) and show the value in the row header (orange background)?

 

Thanks in advance and greetings

 

Michael

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Matrix Table: Average in Row and Sum in Column Header

Hi @Michael_,

 

Create a measure as below;

Measure = IF(ISINSCOPE('Table'[Date]),'Table'[M_SUMOEE],SUMX(VALUES('Table'[Machine]),'Table'[M_SUMOEE]))

And you will see:

Screenshot 2020-09-21 162835.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

View solution in original post

9 REPLIES 9
Highlighted
Continued Contributor
Continued Contributor

Re: Matrix Table: Average in Row and Sum in Column Header

@Michael_ 

 

Please check this link

https://community.powerbi.com/t5/Desktop/SUM-of-AVERAGE/td-p/197013

 

You want Sum and then avg of Sum, in the able link expert has provided the solution for Avg and then sum of Avg. So you can change the logic accordingly.

 

Please let me know if this helps.

Highlighted
Super User II
Super User II

Re: Matrix Table: Average in Row and Sum in Column Header

@Michael_ 

Can you please provide a sample dataset or, even better, a sample PBIX file?

Can you please also clarify the calculations you wish to see for blue and orange highlights?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Highlighted
Regular Visitor

Re: Matrix Table: Average in Row and Sum in Column Header

Hey @PaulDBrown,

thanks for your answer.

I cannot prvide the pbix, but some addition information you requested. Thats the table where the data comes from.

 

Michael__0-1600440107582.png

 

It a simple fact table. Each column which ends with SK, hat a relation to a dimension table. The column Oee and GoodPartAmount are used for calculations.

Blue = Sum of all OEE values per Machine and Shift

Orange = Average of all blue cells for that specific machine and all shifts per machine.

Regards

Michael

Highlighted
Regular Visitor

Re: Matrix Table: Average in Row and Sum in Column Header

Hi @mhossain,

 

I'm not sure how this will solve my problem. How do I get the value only into the Row Header per Group?

 

Regards

 

Michael

Highlighted
Continued Contributor
Continued Contributor

Re: Matrix Table: Average in Row and Sum in Column Header

@Michael_ 

 

Suggestion was to calculate your Sum in the calculated column, so you have sum value for Day/Night etc level, now you create just one measure with Avergage aggregation, and in matrix table, subtotal will show Avg, and for Day/Night Avg will be individual numbers which is sum in your calculated column. Hope this makes sense.

It could have been easier with sample dummy pbix.

Highlighted
Regular Visitor

Re: Matrix Table: Average in Row and Sum in Column Header

@mhossain 

The pbix unfortunately contains sensitive data. Is there any way to alter the data in Power BI? Otherwise, I have to alter the data in the datasource and then import it to Power BI.

Regards

Michael

Highlighted
Super User II
Super User II

Re: Matrix Table: Average in Row and Sum in Column Header

@Michael_ 

One way is to create dummy tables in Excel with equivalent columns (dummy names and values) and use these to replicate the model in PBI. We only need the tables you are using in the matrix (Dimension and fact tables). No need for the whole model.

the tables can be short of course: no need for thousands of rows. 
it is helpful to understand the structure, relationships, hierarchies etc. it may also be useful to check that the actual results are what you are expecting.

also probably simpler than actually altering the original data.





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Highlighted
Community Support
Community Support

Re: Matrix Table: Average in Row and Sum in Column Header

Hi @Michael_,

 

Create a measure as below;

Measure = IF(ISINSCOPE('Table'[Date]),'Table'[M_SUMOEE],SUMX(VALUES('Table'[Machine]),'Table'[M_SUMOEE]))

And you will see:

Screenshot 2020-09-21 162835.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

View solution in original post

Highlighted
Regular Visitor

Re: Matrix Table: Average in Row and Sum in Column Header

Hi @v-kelly-msft,

 

I'm sorry for my late reply. Thank you the provided pbix. Unfortunately the measure seems not to work as I expect. I've added an addition row to the table (see red mark below).  

 

Michael__0-1602632213008.png

 

That is the result in the table

Michael__1-1602632349495.png

Instead of 0.45 (second row, column Average), the value must be 0.9 (0.8 + 0.1). The average value in the header should be 0.74 ((0.9 + 0.78 + 0.55) / 3).

 

Thanks and regards

 

Michael

 

 

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Upcoming Events

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors