This custom query uses the CON_METRICS_TEN_MINUTE_X tables where DPA rolls up metric data like CPU Utilization to 10-minute summaries. This tables stores Min, Max, Avg and Sum values for every 10-minute interval being monitored. Note there are CON_METRICS_HOUR_X and CON_METRICS_DAY_X tables if you want hourly or daily summary data as well.
Adjust the top 4 variables as needed.