Results 1 to 5 of 5
  1. #1
    Leonel is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2017
    Posts
    12

    Subtotal in a column

    Hi, thx for reading

    I looked for a similar question, but I didn't find any, so here's the case.

    I have a table with several records with budget, all grouped by department, and budget type:

    Dep Type USD
    A Operation 500
    A Administration 150
    B Operation 300
    B Administration 200

    How can I get a fourth column (calculation) that shows the subtotal of the budget for the given department? Here the illustration:
    Dep Type USD Subtotal
    A Operation 500 650
    A Administration 150 650
    B Operation 300 500
    B Administration 200 500

    What I want is to then calculate the individual percentage per line for the budget type; for example: 500/650 = 77%, i.e. Operation is 77% of the total budget for Department A.

    Thank you very much


    Leonel

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,523
    1 make a query , qsBudgetTotalsByDept
    do just that, sum the totals per dept.

    in a new query, bring in qsBudgetTotalsByDept,
    and the budget table (to see record by record)

    Join the 2 on Dept,
    bring down the table fields and qsBudgetTotalsByDept.Total

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    Alternatively, build a report and use its Sorting & Grouping features with aggregate calcs.
    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.

  4. #4
    Leonel is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2017
    Posts
    12
    Thank you,

    I was thinking more of having a query and a sub-query (similar to ranman's suggestion), but I'll go for separate queries.

    Thank you all
    lg

  5. #5
    Gicu's Avatar
    Gicu is offline VIP
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    you can also use dsum in the fourth column, if not a lot of data it should be quite fast: dsum ("[USD]","[YourTable]","[Dep]=""" & [Dep] & """")

    Cheers,
    Vlad

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

Similar Threads

  1. Value of Subtotal from Subform Changes
    By GregShah in forum Forms
    Replies: 4
    Last Post: 08-12-2015, 11:40 AM
  2. Use a subtotal and %total
    By finlain in forum Programming
    Replies: 1
    Last Post: 03-28-2013, 09:36 AM
  3. Subtotal on Query
    By claysea in forum Queries
    Replies: 1
    Last Post: 02-17-2012, 10:56 AM
  4. Subtotal Count
    By veritoanimus in forum Queries
    Replies: 3
    Last Post: 12-21-2011, 01:34 PM
  5. Subtotal
    By abc in forum Access
    Replies: 3
    Last Post: 01-31-2011, 04:47 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