Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
danny4202001
Contributor II
Contributor II

Mapping nested aggregation

Hello Friends,

How do I write Mapping nested aggregation in proper form if I keep it this way it throws an error stating nested aggregation is not allowed.
 IF(WildMatch(Forecast_Plant,'22','23') > 0
,sum(Forecast_QTY*(FACTUAL_MATL_COST))+sum(Forecast_QTY*FACTUAL_MATL_OH_COST)
+sum(Forecast_QTY*FACTUAL_RESOURCE_COST)+sum(Forecast_QTY*FACTUAL_OVERHEAD_COST) )
/sum(Forecast_QTY)

*ApplyMap('map_conver_rate',DayStart(Date([ShipDate])),1),

(sum(Forecast_QTY*(FACTUAL_MATL_COST))+sum(Forecast_QTY*FACTUAL_MATL_OH_COST)
+sum(Forecast_QTY*FACTUAL_RESOURCE_COST)+sum(Forecast_QTY*FACTUAL_OVERHEAD_COST) )
/sum(Forecast_QTY) as TL

Thanks,

D

1 Reply
marcus_sommer

For me it doesn't look like a nested aggregation - at least not if all references are fields and not variables. It might be that there is any bracket missing or reverse too much and/or misplaced.

Beside of this you may shorten and/or optimize your expression, for example with something (simplified) like this:

(sum(Forecast_QTY) * Factor1 * Factor2 *) / sum(Forecast_QTY) * if(condition(applymap(), 1)

- Marcus