Entering formula in field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Tischtennisbal
    New Member
    • Nov 2006
    • 13

    Entering formula in field

    Hi,

    I'm using a query which shows the total spend DDP/EUR per month per profit centre (given by the profit centre). I have also added what the total should be (COGS 5999 or 1300).

    I would like to add (in the query) the percentage of reported total spend

    As -> total spend (given by company) / COGS 5999 = ..%

    How can I put that in my query? As I do not know where to place it (i.e. under which fieldname, in the criteria range, what the formula should be etc)

    Code:
    SELECT DISTINCTROW Spend.PcCode, Profit_centre.[Profit centre name], Spend.YEAR, Spend.MONTH, Sum(Spend.[Total spend DDP/EUR]) AS [SumOfTotal spend DDP/EUR], COGS.[5999], COGS.[1300]

    I hope you can help me
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    Something like this ...

    Code:
    SELECT Spend.PcCode, Profit_centre.[Profit centre name], Spend.YEAR, Spend.MONTH, Sum(Spend.[Total spend DDP/EUR]) AS [SumOfTotal spend DDP/EUR], COGS.[5999], COGS.[1300],
    Format([SumOfTotal spend DDP/EUR] /COGS.[5999], "Percent") As PercentSpend
    FROM TableName
    GROUP BY Spend.PcCode, Profit_centre.[Profit centre name], Spend.YEAR, Spend.MONTH, COGS.[5999], COGS.[1300]

    Comment

    Working...