Results 1 to 9 of 9
  1. #1
    james28 is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    92

    Chart grouping in a report

    Hello everyone!




    I am running into a small issue when trying to create a chart in a report in access 2010.


    I have a simple table that I am running a simple query off of. The query is pulling the birthday from everyone in the table as well as the date that they signed up. From there, I created a calculate field called "SignUpAge" which uses the birthday and signup date to calculate a sign up age.

    So far, everything seems to be going just as I would like.


    The problem is, I want to create a bar chart that displays "SignUpAge" from the query. I can create a chart with no problem, but how the chart is displayed is what is giving me trouble. For instance, I want it to be grouped in chunks. Age 1-10 would be one bar, 11-20 would be the next, etc.

    I can only get it to display grouped by each individual age, not by each age range.


    I feel like I need to create a summary table of some sort , to somehow count the number of "SignUpAges" that fall between each age band.

    How I would go about doing that is beyond me though.


    Any help that could be given would be extremely appreciated.


    Thank you !

    James

  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,896
    Create a field in query with expression to calculate age groups.

    Switch([SignUpAge]<11, "Age 1-10", [SignUpAge]<21, "Age 11-20", [SignUpAge]<31, "Age 21-30", [SignUpAge]>=31, "Over 30") AS AgeGroup
    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
    james28 is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    92
    June,

    Thank you for the reply. You seem to be saving the day every where today (and every day, based on the help I have seen from you on threads by other people)!


    I am new to this, but I think I see where you are going. Although I was not able to follow completely.

    I go into my query, into design view, and then what? I clicked on a new column and entered the expression you provided, exactly as you provided it, and it did not like it.

    I then went into criteria, right clicked, and went to builder, and entered it there, also with no success.


    Your example then sparked the thought that maybe I could make each age group its own field. So I created AgeUnder20: 20.01>[Age]>10 and all of the other groups independently. Although this did not give me any errors, when I run the query I just get a bunch of 0s for everything, even though there are entries that meet the criteria.

    I would appreciate any further guidance you can give.

    Thank you again,
    James

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,896
    You did this in the query that already calculates the SignUpAge? Didn't you say the calculated field name is SignUpAge? Why are you using Age?

    What happened - error message, wrong results, nothing?

    Post the SQL for analysis.
    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.

  5. #5
    james28 is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    92
    June,

    Thank you again.

    You are right. I am using SignUpAge. I free handed my example and forgot that is what I called it.


    I understand now!!!!!!! I was pasting your entire line, including the "as agegroup".


    For anyone that may find this later and that happens to be as dense as I am.... you will want to paste: Agegroup: Switch([SignUpAge]<11, "Age 1-10", [SignUpAge]<21, "Age 11-20", [SignUpAge]<31, "Age 21-30", [SignUpAge]>=31, "Over 30") into the "field" section of a new column in your query.




    Two more questions,

    Although everything is working fine now, if I had to "Post the SQl for analysis", what would that entail? Changing "design view" to "Sql view" and pasting everything that shows up?

    Also, is there an easy way to show the Average age of the people in my chart, in my report? I have added a "total" row to my query, (the one that contains the SignUpAge) and set it to "average". This is perfect and displays the proper value. I am just not sure how to get it into my report.


    Thank you!

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,896
    Yes - SQL View.

    If you use the query as report RecordSource, a textbox in report footer could have expression: =Avg([SignUpAge])
    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.

  7. #7
    james28 is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    92
    June,

    Thank you for the reply. Is there anyway to do it if I used a blank report? I used a blank report because I needed to create charts from 12 or so queries.

    If not, I guess I could always use a blank report with 12 sub reports, based on queries, in it. I would like to avoid that way if at all possible though.


    Thanks again!

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,896
    Yes, can use domain aggregate function expression in textbox, like:

    =DAvg("Age", "queryname", "filter criteria here if needed")
    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.

  9. #9
    james28 is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    92
    June,

    I really appreciate all of the time you have spent helping with my various issues today.

    The example that you gave worked great, with just a small tweak. I had to add in [].

    For anyone that finds this later, I used =DAvg("[SignUpAge]","birthdayquer")

    ~Marked as resolved.


    Thank you again!

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

Similar Threads

  1. Grouping in Report
    By New.Dimension6267 in forum Reports
    Replies: 1
    Last Post: 10-11-2013, 10:03 PM
  2. Replies: 10
    Last Post: 08-29-2013, 09:21 PM
  3. Grouping in a report
    By TrackStar in forum Reports
    Replies: 4
    Last Post: 11-02-2012, 01:44 PM
  4. Report grouping
    By tarhim47 in forum Reports
    Replies: 1
    Last Post: 06-08-2011, 04:31 PM
  5. Grouping a report
    By JAJansenJr in forum Reports
    Replies: 0
    Last Post: 03-01-2011, 11:05 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