Results 1 to 4 of 4
  1. #1
    pickslides is offline Novice
    Windows 10 Access 2013
    Join Date
    Dec 2015
    Location
    Melbourne, Australia
    Posts
    9

    Calculate % with multiple conditions with one query

    Hi all,

    I have attached a DB with what I'm trying to achieve. Its a table, I want to find the % using just the one MS Access query. Not sure it can be done?

    The trick is only summing the data for particular AbsentReason when equals only "Late" or "None Given". Also Lesson 1 is only 10 mins and the rest are 50 mins.

    OTUPUT would be

    John = ( (Count of Lessons * 10 or 50) - (Sum of Absent Mins only "Late" or "None Given") ) / (Count of Lessons * 10 or 50) = (520 - 150) / 520 = 71%


    Mary = ( (Count of Lessons * 10 or 50) - (Sum of Absent Mins only "Late" or "None Given") ) / (Count of Lessons * 10 or 50) = (520 - 7) / 520 = 99%



    Thanks Q
    Attached Files Attached Files

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Why must it be done with only one query?
    I don't understand this:
    Also Lesson 1 is only 10 mins and the rest are 50 mins.
    BTW: "Date" and "Name" are Reserved words and should not be used to name any object. Also a poor choice because they tell you little of what the data is about. "FirstName", for example, would be better.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,570
    Your calculations bear no resemblance to the data in the table.

    Mary has a record for Late but the duration is only 5 minutes
    Mary has a record for Not Given but the duration is only 2 minutes ??

    So should the criteria be <=10 ??
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  4. #4
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,570
    How are you arriving at the 520 value ??
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

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

Similar Threads

  1. Replies: 8
    Last Post: 09-08-2017, 01:23 PM
  2. Replies: 8
    Last Post: 02-26-2013, 06:44 PM
  3. Replies: 6
    Last Post: 02-13-2011, 06:02 PM
  4. Update Query - Multiple SETS and WHERE conditions
    By jasonbarnes in forum Queries
    Replies: 26
    Last Post: 12-15-2010, 01:08 PM
  5. Replies: 5
    Last Post: 06-19-2010, 07:55 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