Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5983365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:13:11+00:00 2026-05-22T22:13:11+00:00

In MS Access I am trying to get an average of data but only

  • 0

In MS Access I am trying to get an average of data but only when the last record of each set is larger than a value. almost have it but cant get the last part. So my data looks like so:

 CarID  WeekOf          NumDataPoints   Fuel
 3AA    May-14-2011     4               300
 7BB    May-14-2011     9               250

 3AA    May-21-2011     35              310
 7BB    May-21-2011     7               275

 3AA    May-28-2011     24              355    
 7BB    May-28-2011     4               280

My recordset should include the average of the fuel only for those cars that have a current point count >= 5. So the current week is May-28-2011 and the only car with a point count >= 5 is car 3AA. Doesn’t matter what the point count is in other weeks. i tried

 SELECT CarId, Avg(Fuel) AS AvgF
 FROM tblCars
 WHERE WeekOf>=#5/14/2011# And WeekOf<=#5/28/2011# AND
       CarId = (SELECT CarId FROM tblCars 
                WHERE WeekOf=#5/28/2011# AND NumDataPoints>=5)
 GROUP BY CarId;

I should get back

 CarID AvgF 
 3AA   321.6666

How would I put a criteria only on the current week but get back three weeks when it does pass the criteria?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:13:12+00:00Added an answer on May 22, 2026 at 10:13 pm

    You can use this query to show which cars have 5 or more NumDataPoints.

    SELECT CarID FROM tblCars
    WHERE
        (((WeekOf)=#2011-05-28#)
        AND ((NumDataPoints)>=5));
    

    And this to average the Fuel values for each car over the 3 week range.

    SELECT CarID, Avg(Fuel) AS AvgF
    FROM tblCars
    WHERE
        (((WeekOf)>=#2011-05-14#
        And (WeekOf)<=#2011-05-28#))
    GROUP BY CarID;
    

    INNER JOIN them on CarID so the first query selects a subset of the cars from the second query.

    SELECT whichcars.CarID, fuel_averages.AvgF
    FROM
        [SELECT CarID FROM tblCars
         WHERE
            (((WeekOf)=#2011-05-28#)
            AND ((NumDataPoints)>=5))
        ]. AS whichcars
        INNER JOIN [SELECT CarID, Avg(Fuel) AS AvgF
                    FROM tblCars
                    WHERE
                        (((WeekOf)>=#2011-05-14#
                        And (WeekOf)<=#2011-05-28#))
                    GROUP BY CarID
                    ]. AS fuel_averages
        ON whichcars.CarID = fuel_averages.CarID;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get the access key but I cannot make it work.
I'm trying to get access to the user agent with Flask, but I either
Im trying to get authorization to publish stream and get offline access, but I
I am trying to get access to all the endpoints that a particular contact
I'm trying to get access to the Google Drive API using RestKit on iOS
i am trying to get access to whitepages using YQL. Unfortunately i don't have
I'm trying to get my iPad (3rd gen) to access a website on my
I'm getting the error Illegal access to loading collection when I'm trying to get
I have a C extension (code below) in which I'm trying to get access
In short: How do I access LocationManagerService.mProximityAlerts ? I'm trying to get multiple ProximityAlerts

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.