Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2018
    Posts
    3

    Question Query showing categories in rows and month in columns and total new patients in values

    Hello,



    I have a table named patients with following fields : Id, name, Creation date, referred_by

    I want to create a query showing the following information

    Category JAN FEB MAR APR .......
    Friend 5 2 1 4
    Internet 3 1 1 3
    Other 6 8 2 4

    The numbers are the number of new patients grouped by Category and Month

    Any help please?

    Thanks

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    You need to use a crosstab query. There is a wizard to help do this.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    Join Date
    Jun 2018
    Posts
    3
    Thanks

    Is it possible to have a total for the rows as well ? The system does it for the columns, but I need it for the rows

    Referral Source Total Of ID Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec

    3












    587 128 91 77 78 56
    2

    32 52 71
    friends referral 85 4 5 7 3 16



    35 12 3
    Online Booking 4









    2 2
    Walk-In 1



    1







  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    Not sure exactly what you mean
    The results match your original request (apart from the empty category rows which could be excluded)

    Older versions of Access up to 2010 included pivot tables but these were deprecated in A2013

    Suggest you post some sample data together with the required output
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  5. #5
    Join Date
    Jun 2018
    Posts
    3
    I mean there is a total column for the year for each category of referral

    Can we have a total row for the total number of patients per month (including all categories)? (see line in red please)


    Referral Source Total Of ID Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec

    3












    587 128 91 77 78 56
    2


    32 52 71
    friends referral 85 4 5 7 3 16



    35 12 3
    Online Booking 4









    2 2

    Walk-In

    Total
    1

    132


    96


    84


    81
    1

    73




    2




    67



    66



    Thanks

  6. #6
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    You need to create an aggregate query from your crosstab to get the overall totals per month.
    Or if being used in a report, you can easily get the totals per month.
    HTH
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

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

Similar Threads

  1. Replies: 6
    Last Post: 02-14-2015, 05:40 PM
  2. Pivot Table - Moving Values from Columns to Rows
    By charlatain in forum Access
    Replies: 3
    Last Post: 07-21-2013, 01:41 PM
  3. Replies: 3
    Last Post: 10-17-2012, 09:24 AM
  4. Replies: 2
    Last Post: 05-17-2012, 03:52 PM
  5. Showing Columns & Rows in Crosstab query
    By coach32 in forum Queries
    Replies: 6
    Last Post: 09-11-2011, 07:01 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