Results 1 to 4 of 4
  1. #1
    uaguy3005 is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Mar 2010
    Posts
    45

    Percentage of Total

    I have the following query I would like to add a calculated field that takes the SumOfQtyRejected number and divide it by the total of all the rejects tallied in this query. Hopefully that's not too vague



    SELECT [tblParts].[PartNum] & " - " & [DefectDescription] AS Issue, qzTotInsp.SumOfQtyInspected, Sum(tblRejects.QtyRejected) AS SumOfQtyRejected, [SumOfQtyRejected]/[SumOfQtyInspected]*1000000 AS PPM
    FROM ((tblParts INNER JOIN qzTotInsp ON tblParts.PartID = qzTotInsp.PartID) INNER JOIN tblSortData ON tblParts.PartID = tblSortData.PartsID) INNER JOIN (tblDefectCodes INNER JOIN tblRejects ON tblDefectCodes.DefectID = tblRejects.DefectCode) ON tblSortData.SortDataID = tblRejects.SortDataID
    GROUP BY [tblParts].[PartNum] & " - " & [DefectDescription], qzTotInsp.SumOfQtyInspected

    All help appreciated

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Make a query to sum the values, qsTotals.
    make a new query, qsPct, that uses the data table and qsTotals, that has the totals so you can sum by item,and divide to get pct.

  3. #3
    uaguy3005 is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Mar 2010
    Posts
    45
    Quote Originally Posted by ranman256 View Post
    Make a query to sum the values, qsTotals.
    make a new query, qsPct, that uses the data table and qsTotals, that has the totals so you can sum by item,and divide to get pct.

    What would qsTotals look like? I cant seem to figure out how to get that related back to the query asPct?

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    qsTotals would be an aggregate (GROUP BY) Totals query. Use the query builder.

    Alternatively, build a report and use its Sorting & Grouping feature with aggregate calcs in report and group header/footer textboxes.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Percentage of Total
    By O.92 in forum Queries
    Replies: 4
    Last Post: 12-03-2015, 01:19 AM
  2. How to get Total Sum to percentage%
    By Kitz14 in forum Queries
    Replies: 1
    Last Post: 07-15-2015, 11:02 PM
  3. Replies: 6
    Last Post: 02-23-2014, 03:54 PM
  4. Replies: 28
    Last Post: 03-13-2012, 07:48 AM
  5. Creating a percentage of total records report
    By sai_rlaf in forum Reports
    Replies: 3
    Last Post: 08-12-2011, 11:39 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