select cast(h1.RecCreatedDt as varchar(11)) -- , case when h1.[file] = 1 then 'Data' else 'Indexes' end , sum((h1.SizeInKB - h1.SpaceAvailableInMB) - (h2.SizeInKB - h2.SpaceAvailableInMB)) [Delta MB used] from admin.dbo.SpaceUsedHistory h1 join admin.dbo.SpaceUsedHistory h2 on h1.[database] = h2.[database] --and h1.[File] = h2.[File] and cast(h1.RecCreatedDt - 1 as varchar(11)) = cast(h2.RecCreatedDt as varchar(11)) where h1.[database] = 'DM' and cast(h1.RecCreatedDt as varchar(11)) like 'JUN%' group by cast(h1.RecCreatedDt as varchar(11)) order by cast(h1.RecCreatedDt as varchar(11)) desc