create query to search back a year

Posted on 2011-04-29
Last Modified: 2012-06-27
i have attached a small sample of data.
Is there a way to create a query for this data and find avg daily quantity used based on the field [qty installed]?
problem I have is first how do I join and group data and keep dates?
second can a query say look back a year from today and create daily average based on it?
thank you
Question by:davetough
    LVL 1

    Expert Comment



    Is this what you mean?  There's one query that collects only the rows up to 365 days old based on the current system date.  Then I have added two queries that use the first query's results.  One gives an average of all units (i.e. 234 "somethings") and the other finds the average per description (which would be really better expressed with a definite "category" ID to ensure spelling variances don't confuse things)
    LVL 1

    Accepted Solution

    Sorry, just spotted you were after "daily average".  My bad.

    Please see new attachment instead.  I've started from my previous database but the second level queries don't average now, they sum instead.  Then a third query (or your own report or whatever) divides the resulting sum by 365 to get daily average.  Slightly more complicated work needed to do "working day" average of course.

    Hope it helps anyway.

    Author Closing Comment

    thank you

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
    I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
    In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now