Select skewed data slices

SELECT dsid,
ds_prnct_used,
ideal_ds_prnct_used,
(ds_prnct_used – ideal_ds_prnct_used) ds_prnct_used_delta,
MIN(ds_prnct_used – ideal_ds_prnct_used)OVER(PARTITION BY NULL) ds_prnct_used_delta_min,
MAX(ds_prnct_used – ideal_ds_prnct_used)OVER(PARTITION BY NULL) ds_prnct_used_delta_max,
MAX(ds_prnct_used – ideal_ds_prnct_used)OVER(PARTITION BY NULL) –
MIN(ds_prnct_used – ideal_ds_prnct_used)OVER(PARTITION BY NULL) ds_prnct_used_delta_spread
FROM (
SELECT dsid,
SUM(extents_used)/SUM(extent_count)*100 ds_prnct_used,
SUM(SUM(extents_used))OVER(PARTITION BY NULL)/SUM(SUM(extent_count))OVER(PARTITION BY NULL)*100 ideal_ds_prnct_used
FROM _vt_disk_partition
WHERE isprimary
GROUP BY dsid
) dp
WHERE ABS(ds_prnct_used – ideal_ds_prnct_used) > 2
ORDER BY ABS(ds_prnct_used – ideal_ds_prnct_used) DESC