Results 1 to 5 of 5
  1. #1
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    862

    Only want the last 6 months rotating

    How can I have a rotating count of the last 6 months?



    Additionally I would like to have the columns Calendar sequenced by Month Year.

    This is my Crosstab table:

    TRANSFORM Count([Inq_ID])-1 AS [Count]
    SELECT Inquires.Section
    FROM Inquires
    WHERE (((Inquires.Section)<>"0") AND ((Inquires.[Date Sent]) Between DateSerial(Year(Date()),Month(Date())-5,1) And DateSerial(Year(Date()),Month(Date())+1,0)
    GROUP BY Inquires.Section
    ORDER BY Inquires.Section DESC
    PIVOT Format([Date Sent],"mmm yyyy");

    This is my output: (Each Column is "mmm yyyy")

    "Aug 2014" "Jul 2014" "Jun 2014" "Nov 2014" "Oct 2014" "Sep 2014"

    Thanks

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    If you want the sequence by Month Year then must use month number, not alpha.

    Format([Date Sent], "mm yyyy")
    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
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    862
    Thanks that fixes one issue. Now to figure out a crosstab query in the report!

  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
    53,771
    Building report to run perpetually based on crosstab is not easy because of dynamic nature of crosstab fields. Review (including the additional links in that article) http://allenbrowne.com/ser-67.html
    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
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    862
    June7
    This is what I used and still get rotating months. I use six of the columns in the report 1, 0, -1, -2, -3, -4

    TRANSFORM Count([Inq_ID])-1 AS [Count]
    SELECT Inquires.Actual
    FROM Inquires
    GROUP BY Inquires.Actual
    ORDER BY Inquires.Actual
    PIVOT Year([Date Sent])*12+Format([Date Sent],"mm")-(Year(Now())*12+Format(Now(),"mm"))+1;

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

Similar Threads

  1. Replies: 3
    Last Post: 02-23-2014, 02:06 PM
  2. Rotating header text in a sub-form?
    By ayupchap in forum Forms
    Replies: 8
    Last Post: 01-06-2014, 09:24 AM
  3. Creating a rotating Job list
    By brharrii in forum Queries
    Replies: 4
    Last Post: 05-01-2013, 04:07 PM
  4. Help: Automated Rotating Schedule
    By Breezer23 in forum Access
    Replies: 2
    Last Post: 01-08-2013, 06:56 PM
  5. Rotating list of names
    By bkvisler in forum Access
    Replies: 15
    Last Post: 07-27-2011, 06:49 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