Results 1 to 2 of 2
  1. #1
    access_sql_guy is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2016
    Posts
    4

    Post Calculated query using multiple record lines to find sum of records

    This one has been getting to me lately, I've tried running a macro in excel with the output, but decided to write a query in Access using the following summary data. Factor is what I'm trying to sum, now for each group of Factors (say the are grouped by City), I need to first determine if they are complete, and the date suggests it is completed or not, a blank means it's not completed, then sum the number of factors in the completed row. If not complete, it should populate 0, and then move onto the next record for analysis.



    Sample data:

    Group Factor Completiondate Num
    LA Factor1 1/1/2016 1
    LA Factor2 1/2/2016 1
    LA Factor3 1/5/2016 1
    LA Complete 1/10/2016 3

    I have basically 3-4k of these rows in my query.

    Then after looking at this sample I would move on to the next group, and it may have fewer or more factors.

    Group Factor Completiondate Num
    Chicago Factor1 2/1/2016 1
    Chicago Factor2 2/5/2016 1
    Chicago Complete 2/8/2016 2

    What do you think, I'd like to sum all the number of factor(s), then within that grouping calculate the total factors within that group to come up with the number of completed factor(s).

    I assume using IIF statement within each would work, but I'm currently undecided on how to do that.

    Thank you for reviewing.

  2. #2
    access_sql_guy is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2016
    Posts
    4
    Also, I want to keep it in a query, instead of using a report, because I'm going to export the data with the numbers for each record and run a pivot table. Each completion date will be a column and then I wanted to see how many factors and completions there were each day.

    Thank you, hope that explains further what I was looking for.

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

Similar Threads

  1. noob.. DB for storing multiple lines in to one record
    By wmarke in forum Database Design
    Replies: 9
    Last Post: 06-18-2015, 02:55 PM
  2. Replies: 2
    Last Post: 10-10-2013, 02:27 PM
  3. Split one record into multiple lines
    By Sally in forum Access
    Replies: 1
    Last Post: 03-11-2013, 07:03 PM
  4. Replies: 8
    Last Post: 07-13-2012, 04:53 PM
  5. Multiple lines per record: Report?
    By cjbuechler in forum Queries
    Replies: 7
    Last Post: 07-30-2009, 08:32 AM

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