Gary Croxford
asked on
ADP Report Aggregate Function not allowed
Thank you for looking at my question,
I have a working report in an Access database that groups data by Week, Date and Shift. I have tried to translate this same format to and Access ADP report but the aggregate functions that work in the access report don't work in the ADP report.
An example of one of the aggregate functions is:
=Sum(IIf([ShiftNo]=1,[JobC ount],0)) - this is placed in the control source of a textbox in the report
counts the number of jobs started by Shift1 in a week
The error message I get is:
Aggregate functions are only allowed on output fields of the Record Source
I tried using a CASE statement:
=Sum(CASE WHEN [ShiftNo]=1,[JobCount])
but am told that the expression I have entered contains incorrect syntax.
How do I translate / re write the aggregate function such that it performs dynamic calculation in the adp report.
Thank you
I have a working report in an Access database that groups data by Week, Date and Shift. I have tried to translate this same format to and Access ADP report but the aggregate functions that work in the access report don't work in the ADP report.
An example of one of the aggregate functions is:
=Sum(IIf([ShiftNo]=1,[JobC
counts the number of jobs started by Shift1 in a week
The error message I get is:
Aggregate functions are only allowed on output fields of the Record Source
I tried using a CASE statement:
=Sum(CASE WHEN [ShiftNo]=1,[JobCount])
but am told that the expression I have entered contains incorrect syntax.
How do I translate / re write the aggregate function such that it performs dynamic calculation in the adp report.
Thank you
ASKER
vadimrapp1:
I read that article and to me it suggested that i needed to carry out the calculation in the report footer and then refernce the container in the control source in the week footer. Still get the same error messages
I read that article and to me it suggested that i needed to carry out the calculation in the report footer and then refernce the container in the control source in the week footer. Still get the same error messages
the article says that in the detail section you put the field that calculates the value without the aggregation, and then in the footer you have a field that sums the field in the detail section.
detail ---------------------
field c1 with controlsource =iif(shiftno=1,jobcount,0)
footer --------------------
field c2 with controlsource =sum(c1)
if it still does not work, I suggest that you create a sample adp exactly as in the article, linked to some trivial table in the database; make sure it works, then see what's different with yours. If sample still does not work, you can upload it to this question.
detail ---------------------
field c1 with controlsource =iif(shiftno=1,jobcount,0)
footer --------------------
field c2 with controlsource =sum(c1)
if it still does not work, I suggest that you create a sample adp exactly as in the article, linked to some trivial table in the database; make sure it works, then see what's different with yours. If sample still does not work, you can upload it to this question.
ASKER
I have already tried that approach with the format =Sum([txtJobCount1]) and I get an invalid column name error.
Please proceed to the last paragraph of my previous comment. Maybe remove the square brackets, to begin with.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If the field where you want the calculation is not in the footer, then aggregate in the datasource of the report, o: return already calculated value:
select ..., case when shiftno=1 then jobcount else 0 end as Shift1Jobs, .....