Results 1 to 4 of 4
  1. #1
    Xing is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2015
    Posts
    2

    Average Over Time (Using Date Field)

    I'm trying to determine the Average space usage over time.
    I'm not getting how I query and present the details...

    Table Appears as such:
    VolName | volFreeSpace | runDate
    C | 25 | 1/6/2014 11:03:04 AM
    C | 23 | 2/6/2014 11:00:00 AM
    C | 21 | 3/6/2014 11:00:00 AM
    D | 18 | 1/6/2014 11:18:00 AM
    D | 10 | 2/6/2014 11:00:00 AM
    D | 4 | 3/6/2014 11:00:00 AM
    E | 7 | 1/6/2014 11:02:00 AM
    E | 3 | 2/6/2014 11:00:00 AM
    E | 1 | 3/6/2014 11:00:00 AM

    So how do I Grab the date and present the details in Access though the example below doesn't add the guestimated growth rate.



    volName | volFreeSpace | AVG Use Monthly | Space Longevity in Months
    C | 21 | 2 | 10.5 months
    D | 4 | 7 | .5
    E | 1 | 3 | .3 months

    Any help sincerely appreciated.

    - Xing

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    To pull the latest date record, try TOP N nested subquery, review http://allenbrowne.com/subquery-01.html#TopN

    Don't understand how the AVG Use Monthly and Longevity results shown are obtained. What is the calc you used?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Xing is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2015
    Posts
    2
    I guess I should have stated that I'd like to pull the most recent Free Space and then simply divide that by the average use monthly. This is a basic calculation for now though over time I should probably be able to determine a year over year growth rate of some kind of %.

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    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.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 11-10-2014, 03:14 AM
  2. Replies: 7
    Last Post: 09-02-2014, 08:18 AM
  3. Subtracting a date/time field from a number to get date/time
    By Lifeseeker1019 in forum Programming
    Replies: 4
    Last Post: 03-28-2014, 12:59 PM
  4. Replies: 5
    Last Post: 03-19-2014, 02:31 PM
  5. Replies: 1
    Last Post: 08-04-2010, 04:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums