Results 1 to 3 of 3
  1. #1
    UT227 is offline Expert
    Windows 7 32bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    581

    Trying to get percentages

    I'm trying to get percentages. I made a query to calculate race/ethnicity. There are only a few entries. I need to find out what the percentage of each are. In this example, there are 2 Asian and 3 Hispanic. I'm drawing a blank on how to come up with it. Any ideas?
    Click image for larger version. 

Name:	raceperc1.jpg 
Views:	9 
Size:	28.5 KB 
ID:	30341


    Click image for larger version. 

Name:	raceperc2.jpg 
Views:	9 
Size:	24.5 KB 
ID:	30342

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    Can get complicated because you want to group race count by year and therefore calculate percentages by year I presume. Either need to do grouping by year and race OR group by race and apply filter on year to restrict the records considered.

    Options:

    1. I think simplest approach is to build a report and use its Sorting & Grouping features with aggregate calcs in textboxes - report allows display of detail info as well as summary data

    2. first do an aggregate query that returns one record and value for the total number employees OR multiple records for year grouping. Then include single value query in a query with tblPublicContact without a JOIN clause or if mult-year records join on the year fields. No join or less precise join results in a Cartesian relationship, every record of each table is associated with every record of other table. Now do Aggregate data and calc percentage: Count(*)/First(CountEmp)*100. Can nest the first query within the second to create one SQL statement. Can use Access query builder to help construct. First build and save the inner query. Then build outer query that references the first query object. Switch to SQL view and copy/paste the SQL of the first query between parens in front of the first query name and add the AS word. Then can delete the first query object.

    3. a DCount("*", "tblPublicContact") to return total number of employees in the race count query or DCount("*", "tblPublicContact", "ChkYear=" & [ChkYear])
    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.

  3. #3
    UT227 is offline Expert
    Windows 7 32bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    581
    I was able to do it without the report. Nested a couple queries and did just that. Worked great. Thanks.

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

Similar Threads

  1. How do I query and add percentages?
    By lccrews in forum Queries
    Replies: 3
    Last Post: 08-21-2017, 02:22 PM
  2. Percentages
    By sdel_nevo in forum Forms
    Replies: 1
    Last Post: 03-27-2014, 03:13 AM
  3. percentages
    By sdel_nevo in forum Programming
    Replies: 10
    Last Post: 06-05-2013, 01:00 PM
  4. Percentages Query
    By mabrown81 in forum Queries
    Replies: 12
    Last Post: 11-01-2012, 12:50 PM
  5. How To Compute Percentages
    By zephaneas in forum Queries
    Replies: 7
    Last Post: 06-20-2011, 12:40 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