Results 1 to 10 of 10
  1. #1
    Ianw is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2015
    Posts
    21

    Calcualte a total based on other groups in the same report footer

    Hi,

    I have created a report and used the grouping functionality to group 3 sets of data. However, the first two groups are summed in the group footer. However, I want to be able to divide group 2 into group 1 to come up with a rate in the 3rd group.

    Example

    GROUP 1



    Accum Depn A - $10,000
    B - $20,000
    SubTotal_Accum $30,000 This Subtotal is a sum of A & B

    GROUP 2
    Depreciation Expense C - $1,000
    D - $4,000
    SubTotal_ DepnExp $5,000 This Subtotal is a sum of C & D

    GROUP 3
    Rolling Current Year Trend
    10.00
    5.00
    Sub Total 6.00 This SubTotal is SubTotal_Accum/SubTotal_DepnExp


    I am using Access 2010

    Thanks

    Ian

  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
    Will probably need Sum(IIf(...)) expressions in report footer to calculate sum of A&B and sum of C&D and then those textboxes can be referenced.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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
    Ianw is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2015
    Posts
    21
    Thanks June7. I tried what you suggested.

    I inserted 2 text boxes in the group footer and entered the formula in the control source as follows. SORT_ORDER being the ID of each group where SORT_ORDER number 1 is the Accum Depreciation and 2 is the Depreciation Expense.

    =Sum(IIf([SORT_ORDER] In (1),([CURRENT_MONTH_12]),0)) I renamed the control AccumDep
    =Sum(IIf([SORT_ORDER] In (2),([CURRENT_MONTH_12]),0)) I Renamed this control DepExp

    These formulas give me the answer I am Looking for in each group sub total.

    I then created a inserted a third text box and referenced the previous two text boxes as follows. I don't seem to get an answer.

    =Sum(IIf([SortOrder]=3,([AccumDep]/[DepExp]),0))

    I hope that makes sense.

    Thanks

    Ian

  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
    Aggregate functions cannot reference textboxes. They must reference fields.
    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
    Ianw is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2015
    Posts
    21
    I may be using the wrong terminology. I used the iif statement in the aggregate field in the group footer and then created another aggregate field and then divided one into the other. So they do reference a field.

  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
    AccumDep and DepExp are names of textboxes. You are trying to reference these textboxes in Sum() function. Won't work.

    AccumDep and DepExp already have aggregate sums and already filtered by IIf, why do this again?

    Then:
    =[AccumDep]/[DepExp]
    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
    Ianw is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2015
    Posts
    21
    I guess I am trying to get the take 2 aggregate groups and then divide one by the other to get a ratio for the third group. Sounds like it can't be done. Thanks anyway. I appreciate your time.

  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
    I am sure there is a way but need better understanding of data.

    Options could involve report/subreport or nested queries or domain aggregate functions or just getting the Sum(IIf()) calcs into correct section on report.
    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
    Ianw is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2015
    Posts
    21
    I'll have another look on Monday and try something different. Thanks.

  10. #10
    Ianw is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2015
    Posts
    21
    June7. I went the route of subreports in the report footer and was able to get what I needed. Thanks for the suggestion.

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

Similar Threads

  1. Replies: 8
    Last Post: 04-29-2013, 12:11 PM
  2. Replies: 18
    Last Post: 03-25-2013, 11:08 PM
  3. Replies: 11
    Last Post: 08-27-2012, 11:26 AM
  4. Calculating total values for groups in queries
    By Nixx1401 in forum Queries
    Replies: 7
    Last Post: 02-05-2012, 07:08 PM
  5. Replies: 26
    Last Post: 11-06-2009, 10:16 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