7 Replies Latest reply on May 23, 2018 10:17 AM by ROHINI AVADHANAM

# When creating a calculated field, I am getting following error "Argument to AVG (an aggregate function) is already an aggregation and cannot be further aggregated', how can I get around this?

how can I get around this error?

• ###### 1. Re: When creating a calculated field, I am getting following error "Argument to AVG (an aggregate function) is already an aggregation and cannot be further aggregated', how can I get around this?

You can't apply an aggregation to a field that already has an aggregation.

Most likely you have a calculated field that has an aggregation in it that you're trying to use in another calculation.

If so you might need to get into table calcs (Just depends on what you're asking of your data)

For example:

First Calc:     Profit Ratio

sum([profit])/sum([Sales])               //Aggregate Calc

Second Calc:     Avg of Profit Ratio

window_avg([Profit Ratio])               //Table Calc

• ###### 2. Re: When creating a calculated field, I am getting following error "Argument to AVG (an aggregate function) is already an aggregation and cannot be further aggregated', how can I get around this?

Still not getting the correct results with the suggestions.

My First calculation is to get Cycle Time not to include weekends:

FLOAT((datediff('hour',max([Create Date]),max([Approved Date]))

-

(DATEDIFF('week',DATETRUNC('week',max([Create Date])),DATETRUNC('week',max([Approved Date])))) * 48

-

IIF(DATEPART('weekday', max([Approved Date])) = 1, 48, 0)

-

IIF(DATEPART('weekday', max([Approved Date])) = 7, 24, 0)

+

IIF(DATEPART('weekday', max([Create Date])) = 1, 48, 0)

+

IIF(DATEPART('weekday', max([Create Date])) = 7, 24, 0))/24)

Second Cycle Time is to get the Average of total time:

Avg([Cycle Time - Hours])

Using the WINDOW_AVG  returns the highest average, not the overal average. Any other suggestions?

• ###### 3. Re: When creating a calculated field, I am getting following error "Argument to AVG (an aggregate function) is already an aggregation and cannot be further aggregated', how can I get around this?

How about:  WINDOW_SUM(Avg([Cycle Time - Hours]) // OR WINDOW_SUM([Aggregated Field Name Goes Here...])

Does that get what you need?  If not, post a packaged workbook (you can mock up a sample .twbx if needed) and we can help you arrive at an acceptable solution.

• ###### 4. Re: When creating a calculated field, I am getting following error "Argument to AVG (an aggregate function) is already an aggregation and cannot be further aggregated', how can I get around this?

WINDOW_SUM does not work. Unfortunately I am not able to post a pacakge workbook, data set is pointing to our Production Database and volume is huge.

• ###### 5. Re: When creating a calculated field, I am getting following error "Argument to AVG (an aggregate function) is already an aggregation and cannot be further aggregated', how can I get around this?

What is the propose of getting the Max date values of the first calc?

The first calc needs to be computed at the row level if you want to get an average showing for each mark.

Once again not sure if this is what you need, but if you remove the aggregations from the first calc you’ll be computing at the row level and you can then find an average for the mark level.

• ###### 6. Re: When creating a calculated field, I am getting following error "Argument to AVG (an aggregate function) is already an aggregation and cannot be further aggregated', how can I get around this?

CEILING ([customer count] / [agent_hourly_CHT].[agent count])

want to use ceiling function but gives msg already agregated and cannot be further agregated

How to resolve this?

• ###### 7. Re: When creating a calculated field, I am getting following error "Argument to AVG (an aggregate function) is already an aggregation and cannot be further aggregated', how can I get around this?

Were you able to resolve this ? I am having a similar issue where i am unable to adda multiplication function to my sum .

(ZN([salary])+ZN([incentives])+ZN([bonus]) )*100/fulltime_percentage

The highlighted is something that i am unable to add.

Thanks,

Rohini.