+ Reply to Thread
Results 1 to 7 of 7

Thread: Sort query on sum of count + additional count

  1. #1
    Registered User
    Join Date
    07-06-2006
    Posts
    99

    Sort query on sum of count + additional count

    Hi,

    I want to create a query which sums up the count of my Purchaser. Not for the Purchaser in total but per Group and Organisation as well.

    Seeing as my query building knowledge is insufficient I currently cope by doing the following:

    1) Exporting the Access table to Excel.
    2) Creating a Pivot on this table so I have the sum of count per Purchaser per Group per Organisation.
    3) Copy this Pivot so I can autofill the blanks and then sort descendingly.

    Is it possible to build a query in Access to go straight to the result of point 3?

    I've attached a visual overview of my explanation above. The table mentioned in the overview is also added for people who want to fiddle around in Acces.
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by TomBP; 11-30-2010 at 10:44 AM.

  2. #2
    Valued Forum Contributor alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Lake County, Illinois
    MS-Off Ver
    MS Office 2010, 2007 and 2002
    Posts
    1,161

    Re: Sort query on sum of count

    I created a query using your table. I inserted the field purchaser twice. I then clicked on the summation icon (Sigma--looks like a big E). For one of the purchaser fields I changed it to count. Sorted that field descending. Looks pretty close to what you showed. See attached.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    07-06-2006
    Posts
    99

    Re: Sort query on sum of count

    Hi Alan,

    That's exactly what I'm looking for. Thanks again for your help.

  4. #4
    Registered User
    Join Date
    07-06-2006
    Posts
    99

    Re: Sort query on sum of count

    Hi Alan,

    I am trying to add a second and third count field in the (summation)-query but it either results in:

    Attempt 1: Data type mismatch
    Attempt 2: Wrong count

    Do you mind taking a look at my attempts seeing as you solved this topic and for attempt 2 I used a Dcount expression which you provided for an earlier topic.

    I've attached a visual overview of both attempts. The tables mentioned in the overview are also available in Access.
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Lake County, Illinois
    MS-Off Ver
    MS Office 2010, 2007 and 2002
    Posts
    1,161

    Re: Sort query on sum of count + additional count

    Not sure exactly what you are looking to do. I have attached what I think you may be looking for.

    Alan

  6. #6
    Valued Forum Contributor alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Lake County, Illinois
    MS-Off Ver
    MS Office 2010, 2007 and 2002
    Posts
    1,161

    Re: Sort query on sum of count + additional count

    Forgot to upload attachment.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    07-06-2006
    Posts
    99

    Re: Sort query on sum of count + additional count

    Hi Alan,

    I was looking for this:

    The way to do multiple counts based on a fields value is to use IIF statements with SUM selected in the Totals dropdown

    CountOfNVR: IIf([NVR/VR]="NVR";1;0)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0