Results 1 to 4 of 4
  1. #1
    sberti is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2012
    Posts
    33

    Accumulative sum plus another calculation.

    I need help to know if this is possible and welcome any thoughts:

    Here is a simplified version of my query:

    Date Group Kg Cy
    31-Jan 1 100 $100
    31-Jan 2 200 $200
    28-Feb 1 100 $100
    28-Feb 2 200 $200

    My query has over 400 records with 21 Groups and of course varying Kg and Cy (currency) numbers.

    I want to use that query to make something like this:
    Date Group Kg Cy Accum. Cy Cy/Kg
    31-Jan 1 100 $100 $100 $1.00
    28-Feb 1 100 $100 $200 $2.00
    31-Jan 2 200 $200 $200 $1.00
    28-Feb 2 200 $200 $400 $2.00

    So, I want to Accumulate the Cy (monthly) by Group in one field and then divide that Accum. Cy by the Kg in another field.

    I'm having trouble just getting a single accumulating total Cy, never mind accumulating totals by Group, plus the extra calculation for Cy/Kg.

    Although, if I could get the Accum. Cy totals by Group, the final calculation (Cy/Kg) shouldn't be an issue.

    I've been trying different solutions and I'm starting to think it can't be done in Access.
    Any suggestions?


    Thanks.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I would do this in a report using its Grouping & Sorting with aggregate calcs functionality.
    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
    sberti is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2012
    Posts
    33
    Quote Originally Posted by June7 View Post
    I would do this in a report using its Grouping & Sorting with aggregate calcs functionality.
    Thanks for your suggestion.
    The problem is that this is not the final result I need for my report.
    The data in my previous post is for Operating Expenses. Each month I need to sum ALL the Operating Expenses for a Group from the StartDate (accumulating) and divide that by the KG to get an ExpenseCy/Kg field.
    But I have another set of data (queries) which are Feed Costs. These costs are individual Monthly amounts that DO NOT sum in an accumulative way. This data produces a FeedCy/Kg field.
    For my Report, I need to add the the 'ExpenseCy/Kg' to the 'FeedCy/Kg' in the same record to get TotalMonthlyCosts/Kg per Group.
    I've made a couple of databases that have been useful. Because of them, I've been given this new project. So I'm not completely new to Access, but have not written SQL or VBA. I've just used queries, macros, reports... the regular Access stuff.
    This is more complicated than anything I've tried to do before. Feeling a bit like I'm in over my head. I'm thinking I need to get familiar with SQL & VBA??? Could I do it with either of them?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I am sure could be done. Might require a sequence of queries to get there and if query method too complicated or just not practical VBA with temp table is an option. I have gone both routes.
    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. BMI calculation
    By puush in forum Programming
    Replies: 9
    Last Post: 08-19-2014, 05:05 AM
  2. Pay calculation
    By shankar.nst in forum Programming
    Replies: 2
    Last Post: 09-29-2011, 12:15 PM
  3. Calculation value not less than 1
    By vbpeterson in forum Queries
    Replies: 10
    Last Post: 08-17-2011, 06:41 AM
  4. How to do calculation???
    By latestgood in forum Forms
    Replies: 0
    Last Post: 05-18-2011, 11:11 AM
  5. value calculation
    By kyle in forum Access
    Replies: 3
    Last Post: 03-06-2011, 12:29 PM

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