Results 1 to 11 of 11
  1. #1
    scoobz1234 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Posts
    41

    Bar Graph


    Question... i Wanted to create a Graph that has a bar for each catagory or column that has dates.. i want it to filter to show only the dates greater than 12-31-2011 so basically all dates in 2012.. i figured out how to do a query but i was only able to do a query for ONE column at a time so i'll have like 30 querys...is there a way to do this with one query and have each bar on the graph be for each column and have the graph showing how many people have completed these after 12-31-2011

    Relevant database attached in https://www.accessforums.net/showthr...tact-file-help
    Last edited by June7; 03-30-2012 at 12:22 AM.

  2. #2
    scoobz1234 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Posts
    41
    would making individual queries for each catagory and then making one pivot chart with each bar pertaining to a query be possible?

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    A graph can have only one RowSource. It can be a table or query or an SQL statement. The bars represent data of the RowSource.

    What you want can be done but your data structure makes it difficult. For starters, the date fields are text, not date/time datatype. This must be changed in order to do filter/sort by date criteria. Fix that and post a new database and we can proceed. Can make a copy and delete all those reports not needed for this issue, run Compact & Repair, then zip.
    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.

  4. #4
    scoobz1234 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Posts
    41
    Tester DB.zip Here is the Database i changed the items to dates and i also set them to show as a medium date. pretty much anything with a date except birthdates i want to show on a bar graph, ULTIMATELY i would like it to show Percentage of the dates that are "Current" we call it Training Completion percentage. if not a simple number complete is great. also is there a way to show the number total of people on the data base so it can easily be seen how many people are missing the completion?

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    The first step is to rearrange the data to a normalized structure. This requires a UNION query. There is no designer or wizard for UNION, must type in the SQL view of query designer. There is a limit of 50 lines in a UNION (unless this has changed with Access 2010). This example shows only 3 of the training categories from your table. Continue adding lines for the others you want.

    SELECT ID, [Last Name], [First Name], Rank, "Swim" AS Category, [Swim Requal Date] As CatDate FROM [Main Database]
    UNION SELECT ID, [Last Name], [First Name], Rank, "Orm", [Annual Orm Training-NKO] FROM [Main Database]
    UNION SELECT ID, [Last Name], [First Name], Rank, "Basic", [Basic Info & Personal Security] FROM [Main Database];

    Use the UNION query as basis for aggregate calculations and for a CROSSTAB query.

    SELECT Category, Count(ID) AS CountOfID, (SELECT Count(ID) As Total FROM [Main Database]) AS TotalStaff
    FROM MainUNION
    WHERE CatDate>#12/31/2011#
    GROUP BY MainUNION.Category;

    That query I called MainSUM. Set the RowSource of a bar graph to SELECT Category, CountOfID FROM MainSUM; and a simple charting of the total completed for each category will show.

    I am not sure what the percentage calc you want is. Is it the percentage of total categories each individual has completed meaning a chart that shows all 63 individuals, or an overall percentage of staff completed by category? For the latter try this as graph RowSource:
    SELECT [Category], Sum([CountOfID]/[TotalStaff])*100 AS Percentage FROM MainSUM GROUP BY [Category];

    I just noticed the table has dates greater than the current date (2013, 2014). These records are not excluded from the above queries. Apply whatever filter criteria is needed in the MainSUM query.
    Last edited by June7; 03-31-2012 at 03:14 PM.
    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.

  6. #6
    scoobz1234 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Posts
    41
    some of the dates are drop dead dates, the current training is void on that date, some training is Fiscal Year, and some is Calendar Year. having said that, is there a way to make this do that for the specific ones.. i have added all my fields to the UNION that have a date (except the Birthdate one)...

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    By 'specific ones' you mean the different date categories? How can we know which are 'drop dead', which are Fiscal Year, and which are Calendar Year?

    Have you tried the graphs I suggested as a test?
    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.

  8. #8
    scoobz1234 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Posts
    41
    (PFT/NBC/ORM/BASIC INFO/ANTI TERRORSIM/COMBAT TRAFFICKING) These are all calendar year so Greater than 12-31-2011.. (RIFLE/PISTOL/INFORMATION ASSURANCE/SUICIDEPREVENTION/STD&HIV/ALCOHOL&SUBSTANCE/TOBACCO/NUTRITION/INJURY PREVENTION/PHYSICAL FITNESS) These are all Fiscal Year so Greater than 10-01-11.. the left over ones after this are the CFT which is Greater than 06-30-2011...and swim qual...swim qual is a tricky one, it has to be greater than Date() i believe the way to do it is, as long as its after the current days date its good.

  9. #9
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    That does complicate things. Approach options:

    1. Include WHERE clause in each SELECT line of the UNION query.

    2. Build a public function that can be called from any query that uses the UNION as data source and will return the correct date parameter for each record based on the category for each record.

    Never done either before but just tested No1 and seems to work.

    If fiscal year starts 10/1/yyyy use >9/30/yyyy

    Regardless of the approach, making the date parameter dynamic for the changing years is another issue.
    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.

  10. #10
    scoobz1234 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Posts
    41
    so it would probably be wise to set this up with seperate graphs, multiple unions? one for the Fiscal Year items and one for the Annual..

  11. #11
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    One union should serve. Just build queries off of it for the graphing.

    It can be done on one graph as I have described. I would go with option 2 but then I know how to write code.
    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. Replies: 6
    Last Post: 02-29-2012, 03:13 AM
  2. Graph
    By Ray67 in forum Reports
    Replies: 8
    Last Post: 10-15-2011, 10:38 AM
  3. Replies: 3
    Last Post: 01-10-2011, 10:31 AM
  4. Adjusting the axis of a graph using VBA
    By Sniper-BoOyA- in forum Programming
    Replies: 0
    Last Post: 08-04-2010, 06:41 AM
  5. Chart/Graph
    By Tony McGuire in forum Access
    Replies: 0
    Last Post: 09-13-2009, 04:17 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