Re: Simple Sum Calculation but I can't work it out......
From: Chris (anonymous_at_discussions.microsoft.com)
Date: 03/05/04
- Next message: Kevin: "Re: Simple Sum Calculation but I can't work it out......"
- Previous message: Jim Franklin: "Re: DCOUNT function in query?"
- In reply to: Kevin: "Re: Simple Sum Calculation but I can't work it out......"
- Next in thread: Kevin: "Re: Simple Sum Calculation but I can't work it out......"
- Reply: Kevin: "Re: Simple Sum Calculation but I can't work it out......"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 5 Mar 2004 03:05:36 -0800
Thanks Kevin
This is the SQL query I have:
SELECT Test.[Customer Accounts], Sum(Test.Revenue) AS
SumOfRevenue, [revenue]/Sum([revenue]) AS [Percent]
FROM Test
GROUP BY Test.[Customer Accounts];
It doesn't seem to want to work.
>-----Original Message-----
>I do it using straight SQL... so go to design view of
your query... then
>change to SQL view...
>
>If you query is
>
>select field1, Calculated Value from tblSomeTable
>
>you can then add the group by clause to group related
records together like
>this:
>
>SELECT Field1, CalculatedValue from tblSomeTable GROUP BY
field1,
>CalculatedValue
>
>If you look at the SQL for your query and you have a
group by clause, you'll
>need to add the exact text you have doing the
calculation. According to your
>first post that'd be:
>
>[Revenue]/sum([revenue])
>
>I think you'll find all calculated values need to be in
the group by clause
>but data values don't... could be wrong...
>
>By the way, you can do the grouping bit in straight
design view but can't
>remember how...
>
>Post the SQL for your query if you get stuck...
>
>Cheers
>
>
>"cpevans@aol.com" <anonymous@discussions.microsoft.com>
wrote in message
>news:778601c4029e$fcac86f0$a001280a@phx.gbl...
>> Maybe this is a stupid question(!) but how do I do that?
>>
>>
>> >-----Original Message-----
>> >No expert... but, I think you need to add [Revenue] to
>> the group by
>> >clause...
>> >
>> >Cheers
>> >
>> >
>> >"Chris" <cpevans@aol.com> wrote in message
>> >news:785501c4029c$f5550500$a401280a@phx.gbl...
>> >> I am new to Access and am trying to insert a simple
>> >> calculated field in a query but I am having
difficulty.
>> >>
>> >> I have one field of all customers and another of all
>> >> revenue associated to that customer. I want to
insert a
>> >> calculated field that will give me a % of total
revenue
>> >> for each customer.
>> >>
>> >> Here is what I am trying:
>> >>
>> >> Percent: [Revenue]/sum([revenue])
>> >>
>> >> This keeps giving me the following error message:
>> >>
>> >> You tried to execute a query that does not include
the
>> >> specified expression 'Customer Account' as part of an
>> >> aggregate function.
>> >>
>> >>
>> >> Can anyone help!?
>> >>
>> >> Many thanks
>> >>
>> >> Chris
>> >
>> >
>> >.
>> >
>
>
>.
>
- Next message: Kevin: "Re: Simple Sum Calculation but I can't work it out......"
- Previous message: Jim Franklin: "Re: DCOUNT function in query?"
- In reply to: Kevin: "Re: Simple Sum Calculation but I can't work it out......"
- Next in thread: Kevin: "Re: Simple Sum Calculation but I can't work it out......"
- Reply: Kevin: "Re: Simple Sum Calculation but I can't work it out......"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|