Results 1 to 3 of 3
  1. #1
    rlmax is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jan 2017
    Posts
    6

    Sum fields from column heading in crosstab query

    I have a crosstab query set up with Month as row headings, Pool (or grouping) as column headings and the sum of balances as values. There are 6 "Pool" values: 0 through 5. I am trying to sum only pools 3, 4 and 5. Here is my query:

    TRANSFORM Sum(delFebruary.Balance) AS SumOfBalance
    SELECT Format([BookingDate],"mm-yyyy") AS Month
    FROM delFebruary RIGHT JOIN Originations ON delFebruary.[Member#] = Originations.MemberNumber


    GROUP BY Format([BookingDate],"mm-yyyy")
    ORDER BY Format([BookingDate],"mm-yyyy")
    PIVOT delFebruary.[Del Pool];

    I can add criteria to [Del Pool] but that only filters out the columns I don't want to see.

    I also tried DSum, but I couldn't get that to work either. I tried DSum("Balances","delFebruary","[Del Pool] > 2"") which returned the same number for every row and column.

    Any thoughts?

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,930
    try

    pools3to5:sum(iif([del pool] in (3,4,5),Balance,0))

    or

    pools3to5:sum(iif([del pool] between 3 and 5,Balance,0))

    or

    pools3to5:sum(iif([del pool] >=3 and [del pool]<=5,Balance,0))

  3. #3
    rlmax is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jan 2017
    Posts
    6
    All three of those worked. You are my hero!

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

Similar Threads

  1. Replies: 3
    Last Post: 09-21-2016, 10:11 AM
  2. Month Name in CrossTab Heading
    By stumped in forum Queries
    Replies: 2
    Last Post: 09-27-2012, 02:29 PM
  3. Replies: 4
    Last Post: 07-27-2012, 07:04 AM
  4. Replies: 3
    Last Post: 02-21-2012, 10:15 AM
  5. Replies: 20
    Last Post: 02-14-2011, 10:55 AM

Tags for this Thread

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