Results 1 to 3 of 3
  1. #1
    jbr87 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    14

    Conditional count

    Hi guys and girls,



    I'm looking to build a querry that finds duplicate entries of a feild named "assembly_position" and contains two counts, one count that finds the number of times an entry is duplicated. The second count has to count how many of the duplicate entries have been shipped by looking into a "load" feild checking if the field is not null.

    so we take my table1:

    Code:
    AsemPos, load
    A1, l1
    A1, l2
    A1, 
    A3, l1
    A2,
    A2,
    A3,
    the result I'm looking for is:

    Code:
    AsemPos, Countod unique AP, Count of shipped
    A1, 3, 2
    A2, 2, 0
    A3 ,2 ,1
    I currently am able to get the unique entries as well as the first count with the following SQL statments

    SELECT Sheet1.Assembly_position, Count(Sheet1.Assembly_position) AS CountOfAssembly_position
    FROM Sheet1
    GROUP BY Sheet1.Assembly_position;

    What I need help with is the conditional count of the Items that have been shipped.

    Thanks,
    Jeff
    Last edited by jbr87; 09-28-2011 at 05:55 AM.

  2. #2
    maximus's Avatar
    maximus is offline Expert
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    Tried to replicate your problem I have a Table Table4 with the Fields AssemPos and Load. I have entered the same data you have posted.

    I have the following Query:

    Column Dup will reflect the Count of an AssemPos Item.
    Column LoadCount will show the Count of the AssemPos Item Loaded.


    SELECT Table4.AssemPos, DCount("[Assempos]","Table4","[AssemPos]='" & [AssemPos] & "'") AS Dup, DCount("[Load]","Table4","[AssemPos]='" & [Assempos] & "'") AS LoadCount
    FROM Table4
    GROUP BY Table4.AssemPos;

  3. #3
    jbr87 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    14
    Quote Originally Posted by maximus View Post
    Tried to replicate your problem I have a Table Table4 with the Fields AssemPos and Load. I have entered the same data you have posted.

    I have the following Query:

    Column Dup will reflect the Count of an AssemPos Item.
    Column LoadCount will show the Count of the AssemPos Item Loaded.


    SELECT Table4.AssemPos, DCount("[Assempos]","Table4","[AssemPos]='" & [AssemPos] & "'") AS Dup, DCount("[Load]","Table4","[AssemPos]='" & [Assempos] & "'") AS LoadCount
    FROM Table4
    GROUP BY Table4.AssemPos;

    Works like a charm thank you so much

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

Similar Threads

  1. Conditional Formula?
    By nellolopez in forum Access
    Replies: 1
    Last Post: 05-05-2011, 06:17 AM
  2. Conditional Summation
    By megabrown in forum Queries
    Replies: 15
    Last Post: 12-08-2010, 06:19 PM
  3. Conditional Formatting
    By Desstro in forum Programming
    Replies: 3
    Last Post: 12-01-2010, 09:52 PM
  4. count with conditional
    By humpz in forum Reports
    Replies: 3
    Last Post: 08-02-2009, 08:11 AM
  5. Conditional formatting
    By ylivne in forum Reports
    Replies: 1
    Last Post: 07-12-2009, 06:18 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