Subqueries in reports?

I’m looking to generate a graph showing average downtime over the course of 4 different shifts on 8 different production lines for use in a report that is sent every 3 days. The problem being once i”ve narrowed the table to only the maximum downtimes per shift, I cannot average those maximum values over the 3 days. For example, line B had total downtime of 137 min on Monday, 112 minutes on Tuesday, and 89 minutes on Wednesday. My script is able to pull the total data and view each of the respective downtimes using Max(downtime), but from here I’d like to average that data to show average downtime over the timespan.

I’ve looked into nested queries but am struggling to understand how to write them/if they’re even applicable in this situation.

Can you show your query and any other data sources in the report?