Results 1 to 2 of 2
  1. #1
    davey is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2018
    Posts
    6

    Counting unique values based on multiple criteria

    Hi there, I am trying to make a report more efficient in its output and am struggling to get the correct formula for it. In the below example, you can see that I am calculating the number of batches created in a shift for each of our production lines, this is done in my query by counting the batch IDs. I have then brought in a field with the number 1 in it so that I can calculate the average number of batches produced by production line on a given shift and day. Clearly this is not the best approach but I am a stumped as to how to fix this. In my second screenshot I have given what my desired output will be - the number of batches by date and shift will be summed and then there is a count given of the number of unit produciton lines, rather than having to list them individually.



    Thanks in advance for your help.

    Click image for larger version. 

Name:	example1.JPG 
Views:	8 
Size:	39.7 KB 
ID:	35680

    Click image for larger version. 

Name:	Example 2.JPG 
Views:	8 
Size:	15.3 KB 
ID:	35681

  2. #2
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Do an aggregate query with 4 fields
    Group by Shift date & Shift.
    Add Batches and change Group By to Sum
    Add Production Line & change Group By to Count
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

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

Similar Threads

  1. Unique Values Count still counting duplicates
    By Miskondukt in forum Queries
    Replies: 6
    Last Post: 09-21-2017, 09:52 AM
  2. Counting unique values in a query
    By DHIGHTO in forum Queries
    Replies: 4
    Last Post: 01-21-2015, 08:19 AM
  3. Replies: 8
    Last Post: 10-22-2013, 05:08 PM
  4. Replies: 2
    Last Post: 05-16-2012, 04:45 PM
  5. Counting records based on specified criteria
    By GrnISSO in forum Queries
    Replies: 2
    Last Post: 10-04-2007, 03:07 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