Results 1 to 5 of 5
  1. #1
    Santhosh is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Dec 2019
    Posts
    3

    Multiply values in two tables based on filtered condtion in both tables

    I have two tables: (a) Calendar dates (b) Monthly Expenses budgeted




    Calendar_dates table field are
    (a) Day (Calendar day for 4 months)
    (b) Daily rates %


    Monthly expenses budgeted table fields are


    (1) Business line1
    (2) Business Category
    (3) Business Grooup
    (4) Month1 expense budgeted amount
    (5) Month2 expense budgeted amount
    (6) Month3 expeense budgeted amount
    (7) Month4 expnense budgeted amount


    i need to multiply daily rates% for a particular day with the corresponding month expense budgeted amount in Monthly expense table. The output should be in following format:


    (1) Calendar day (from days table)
    (2) Business Line1
    (3) Business group
    (4) (Calendar_Dates.Daily rates%) * corresponding month expense budgeted amount




    I am able to multiply all the daily rates for a single month expense budgeted amount in a simple query. If someone could help me to multiply based on the corresponding month criteria it would be very helpful

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Provide sample data. If you want to provide db for analysis, follow instructions at bottom of my post.

    Exactly what data is in Day field - a full date?

    Which months would be Month1 - Jan, May, Sep


    Day is a reserved word and should not use reserved words as names for anything. Also advise not to use space nor punctuation/special characters in naming convention.
    Last edited by June7; 12-18-2019 at 02:59 AM.
    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
    Santhosh is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Dec 2019
    Posts
    3

    Sample data attached

    Sample data attached. Output worksheet is the result that i am expecting in MS-access query
    Attached Files Attached Files

  4. #4
    Santhosh is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Dec 2019
    Posts
    3
    I am looking at a daily calculation sample data is attached

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Monthy_Expense_Budget is not normalized structure. Your example output has wrong year for Jan and uses Jan date for Feb. Desired outcome can be accomplished with Cartesian query.

    SELECT Calendar_Date.Date, Monthly_Expense_Budget.BusinessLine1, Monthly_Expense_Budget.BusCategory, Monthly_Expense_Budget.BusGroup,
    Calendar_Date.WeightPct,
    Format([Date],"yyyymmm") AS YrMon,
    [WeightPct]*Switch([YrMon]="2019Dec",[Dec19BudgetAmt],[YrMon]="2020Jan",[Jan20BudgetAmt],[YrMon]="2020Feb",[Feb20BudgetAmt],[YrMon]="2020Mar",[Mar20BudgetAmt]) AS Result
    FROM Monthly_Expense_Budget, Calendar_Date;

    You will have to modify the query every time the months change.
    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. Replies: 17
    Last Post: 09-19-2018, 09:20 AM
  2. Replies: 2
    Last Post: 09-28-2017, 06:56 PM
  3. Replies: 3
    Last Post: 03-01-2017, 02:46 PM
  4. Replies: 1
    Last Post: 02-23-2017, 09:09 AM
  5. Replies: 8
    Last Post: 05-25-2010, 04:50 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