Results 1 to 3 of 3
  1. #1
    Turncloud is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2013
    Posts
    22

    Grab the value in one record and apply it to a calculation in multiple records.Query?

    In my database I have multiple company records, along with details of their annual spend. There is also a record called Grand Total which has a value for the spend for all of these customers (this is an import from a spreadsheet produced monthly).


    I need to create a calculated field which is the spend for each company as a percentage of the grand total.

    i.e. Concentration = spend / grand total *100

    How can I reference this in a calculated field, given that 'grand total' is sort of a query, e.g x = 'total' where 'reference'="grand total" ..?

  2. #2
    BluffMeAllIn is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Dec 2013
    Location
    Canada
    Posts
    21
    Hi Turncloud,

    A little confused by your inquiry TBH.

    You have indicated you have a database with multiple company records and details of their annual spending. However you indicate you also have a grand total which essentially would be a sum of the annual spending for all companies correct, however you have indicated the grand total is actually an import from a spreadsheet produced each month?????

    Obv I am not sure how your database is designed but at basics it would have a company table, and spending details table. Is the spending details what you mean is being imported into the database each month from an excel spreadsheet? When you indicate you need to create a calculated field is this for an output report or you want to create a calculated field within the table?????

    In general it's rarily common or best practice to store calculated fields when they can easily be calculated on the fly for report outputs. However if you are created for a report or within a table you should simply be able to reference the grant total field in the table doing your calculation?

    Any details regarding my questions would go a long way in being able to assist with your issue.

    Thanks,
    Dave

  3. #3
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    Code:
    SELECT
       ... various fields ...,
       DLookup("[MyTotal]","[MyTable]","[MyReference] = 'Grand Total'") As MyGrandTotal,
       MyTotal,
       (MyTotal/MyGrandTotal) As MyConcentration
    FROM
       MyTable;

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

Similar Threads

  1. Replies: 7
    Last Post: 11-01-2013, 09:14 AM
  2. Replies: 2
    Last Post: 09-11-2012, 11:02 AM
  3. Replies: 3
    Last Post: 01-19-2012, 06:02 PM
  4. Apply Multiple filters
    By spitfire122 in forum Access
    Replies: 2
    Last Post: 07-01-2011, 10:02 AM
  5. Replies: 2
    Last Post: 08-05-2010, 09:07 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