Results 1 to 4 of 4
  1. #1
    Gryphoune is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    24

    Query to sum results of two crosstab queries

    I have two crosstab queries that pull quarterly sums; one for revenue recovered and one for revenue lost. what I would like to do is, if possible is to have a query that can subtract the lost revenue from the recovered revenue and give the balance on a quarterly basis. I have inserted screens of the two queries and a sample of the resulting reports generated.

    Click image for larger version. 

Name:	RecoveredXTab.PNG 
Views:	7 
Size:	32.7 KB 
ID:	17531 Click image for larger version. 

Name:	LossXTab.PNG 
Views:	7 
Size:	30.6 KB 
ID:	17532



    Click image for larger version. 

Name:	YTD Qtrly Rcvrd 1.PNG 
Views:	7 
Size:	32.6 KB 
ID:	17534
    Click image for larger version. 

Name:	YTD Qtrly Rcvrd 2.PNG 
Views:	7 
Size:	15.1 KB 
ID:	17536
    Attached Thumbnails Attached Thumbnails YTD Qtrly Loss 1.PNG  

  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
    52,902
    Does each crosstab have the same Property IDs? If they do, build another query that joins the two on that common field. If not, join them to table that does have all the property IDs.
    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
    Gryphoune is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    24
    Well this would probably have been the solution but now things have changed slightly in that we are no longer grouping the properties so the Property Groupd Table is history. So now I need to build a query that gives me a quarterly summary of the recovered minus the loss xtabs.

    I'm just getting back into Access after not using it for almost 10 years so my skills are a bit rusty and have inheirited this database which was built by a self taught. So the structure may a bit off but it is currently working sufficiently with some tweaking and changing needs.

  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
    52,902
    And the issue is... How to group records by quarter?

    Create a field in query that calculates the quarter and use that for grouping criteria. Will probably also need the year for grouping and/or filtering.

    Yr: Year([datefield])

    Qtr: DatePart("q",[datefield])

    or

    YrQtr: Year([datefield) & DatePart("q",[datefield])
    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. Union query to join two crosstab queries
    By racefan91 in forum Queries
    Replies: 5
    Last Post: 09-26-2013, 10:24 AM
  2. Replies: 3
    Last Post: 09-04-2013, 03:21 PM
  3. Sorting Crosstab query results?
    By Dragongem in forum Queries
    Replies: 1
    Last Post: 06-13-2013, 09:21 PM
  4. Replies: 5
    Last Post: 08-29-2011, 09:37 AM
  5. Replies: 16
    Last Post: 09-23-2009, 08:47 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