K
Kevin
No expert... but, I think you need to add [Revenue] to the group by
clause...
Cheers
clause...
Cheers
-----Original Message-----
No expert... but, I think you need to add [Revenue] to the group by
clause...
Cheers
Chris said: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
.
[email protected] said: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 said: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
.
Chris said: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
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
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
.
.
-----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
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
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
.
.
-----Original Message-----
Yeah, you need to add the other fields in the select part of the query to
the group by clause... something like:
SELECT Test.[Customer Accounts], Sum(Test.Revenue) AS SumOfRevenue,
[revenue]/Sum([revenue]) AS [Percent]
FROM Test
GROUP BY Test.[Customer Accounts], SumOfRevenue, [Percent]
I think that should work now... try it... if not copy the entire select
section to the group by like so:
SELECT Test.[Customer Accounts], Sum(Test.Revenue) AS SumOfRevenue,
[revenue]/Sum([revenue]) AS [Percent]
FROM Test
GROUP BY Test.[Customer Accounts], Sum(Test.Revenue) AS SumOfRevenue,
[revenue]/Sum([revenue]) AS [Percent]
I think the first is correct and the second will probably give an error...
try it...
Cheers
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.
BY-----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
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
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
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
.
.
.