Code:
SELECT tblVolumes.VolName, Max([volfreespace])-Min([volfreespace]) AS SpaceChange, (Max([volfreespace])-Min([volfreespace]))/(Count([volname])-1) AS SpaceAvg
FROM tblVolumes
GROUP BY tblVolumes.VolName;
from here you can calculate remaining time based on the free space left as of the most recent record. Just be aware that 'cleaning up' the servers as in archiving data and moving it off the server in the middle of a span will wreak havoc with this calculation:
This is my table:
VolName |
VolFreeSpace |
RunDate |
C |
25 |
1/6/2014 |
C |
23 |
2/6/2014 |
C |
21 |
3/6/2014 |
D |
18 |
1/6/2014 |
D |
10 |
2/6/2014 |
D |
4 |
3/6/2014 |
E |
7 |
1/6/2014 |
E |
3 |
2/6/2014 |
E |
1 |
3/6/2014 |
Save this query as qryMaxDriveDate
Code:
SELECT Max(tblVolumes.RunDate) AS MaxRunDate, tblVolumes.VolName AS MaxVolName
FROM tblVolumes
GROUP BY tblVolumes.VolName;
Create this query:
Code:
SELECT tblVolumes.VolName, Max([volfreespace])-Min([volfreespace]) AS SpaceChange, (Max([volfreespace])-Min([volfreespace]))/(Count([volname])-1) AS SpaceAvg, Max(IIf([rundate]=[maxrundate],[volfreespace],0)) AS SpaceLeft, (Max(IIf([rundate]=[maxrundate],[volfreespace],0)))/((Max([volfreespace])-Min([volfreespace]))/(Count([volname])-1)) AS TimeLeft
FROM tblVolumes LEFT JOIN qryMaxDriveDate ON (tblVolumes.RunDate = qryMaxDriveDate.MaxRunDate) AND (tblVolumes.VolName = qryMaxDriveDate.MaxVolName)
GROUP BY tblVolumes.VolName;
you can break apart the formulas to show how I constructed them.