Results 1 to 3 of 3
  1. #1
    voro is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    9

    Compare with table coulumn count

    HI All



    I have a small problem.

    I have a union query that shows me types of errors and the number of them.
    I laso have a table called Main which holds all the data.

    Now lets say count of errors is 500 in the union query and i wish to present it as a % of total rows in the Main table 8000 so 500/8000 = 6%
    Main table and union query are not anyhow joined, i could via Emp ID but i am not sure if that will help.

    I made a query that shows all the columns from union query and only emp id column from Main as count. So now every line in union query has 8000 next to it representing count of all rows from Main table.

    I tried but i cant show 500(errors) as a % of cell value (count of emp id - 8000) in pivot among things.

    Additionally if it was possible to guide me how to show the break down of each error's constitution to the overall 6% it would just be fantastic.

    Hope i am clear and if now plz let me know.

    Thanks
    Regards
    Peter

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    There are two ways you can do this

    The first way is to make a query that simply has one field, and that field is a count of records in your 'main' table.

    Add that table to your query that has the 500 errors and add the total error count field to your query.

    do not link the tables

    This is called a cartesian query, basically it creates a value for every possible combination of values from tablea and tableb, basically you multiply the number of items in each table together and you'll get your final record count.

    Since you are after one value (total errors) this shouldn't cause you any problems.

    Then in your third column you divide your error count for that line by the total error count to get the percentage.
    ---

    The second way, which I would not recommend, is to use a dcount function in your existing query

    dcount("*","[Error Table]")

    to get the total records

    domain functions are incredibly resource heavy and should not be used in queries, ever but good advice never stopped anyone from trying to do it anyway!

  3. #3
    voro is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    9
    Thanks alot for your support. Much appreciated !

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

Similar Threads

  1. Replies: 5
    Last Post: 05-02-2012, 07:56 AM
  2. Replies: 14
    Last Post: 01-12-2012, 05:03 PM
  3. Compare Two types of records from one table
    By pstrahan in forum Access
    Replies: 1
    Last Post: 08-10-2011, 11:22 AM
  4. Replies: 1
    Last Post: 12-01-2010, 11:01 AM
  5. Replies: 0
    Last Post: 08-01-2009, 12:43 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