Results 1 to 3 of 3
  1. #1
    Littlewood is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2015
    Posts
    2

    How to create query to show percentages.

    Click image for larger version. 

Name:	prec_access.jpg 
Views:	10 
Size:	42.6 KB 
ID:	21070



    Guys,

    Essentially I have both these queries.

    One to show the total number of 'valves' by a certain manufacturer and another to show the certain number of valves that have failed their annual test by a certain manufacturer.

    What I want to do it, look the the total number of valves for 'Noneywell' for example, then look at the total number of fails - and return that as a percentage.

    Any help will be greatfully recieved.

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You can perform a query between these two query, joining on the "Make" field.
    If you set it up so that it is a Left Join from the Total_by_Model query to the TotalFailed_by_Model query, it will return all your records.
    Use the NZ function to return the total number of failures, that way you can have it return a 0 when there is no match.
    Then just divide the two values to get your percentage.

  3. #3
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    The SQL code of that query would look something like this:
    Code:
    SELECT 
        Total_by_model.Make, 
        Total_by_model.CountOfMake, 
        Nz([TotalFailed_by_model]![CountOfMake],0)+0 AS Failed, 
        Nz([TotalFailed_by_model]![CountOfMake],0)/[Total_by_model]![CountOfMake] AS Percent_Failed
    FROM Total_by_model 
    LEFT JOIN TotalFailed_by_model 
    ON Total_by_model.Make = TotalFailed_by_model.Make;

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

Similar Threads

  1. Crosstab Query with Percentages of Total
    By McArthurGDM in forum Queries
    Replies: 4
    Last Post: 05-07-2015, 02:48 PM
  2. Percentages of Column Values in a Query
    By kheneasar in forum Queries
    Replies: 1
    Last Post: 01-28-2015, 09:40 AM
  3. query that generates percentages
    By jppevy in forum Access
    Replies: 3
    Last Post: 07-30-2013, 10:44 PM
  4. Percentages Query
    By mabrown81 in forum Queries
    Replies: 12
    Last Post: 11-01-2012, 12:50 PM
  5. Crosstab query - adding percentages
    By bruegel in forum Queries
    Replies: 9
    Last Post: 07-31-2012, 09:50 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