This script is a global version the following across all monitored instances for a specific metric. At the top are 3 variables you can set to control the timespan and the metric name.
Resource Metric Report - Custom Queries - Database Performance Analyzer - THWACK