Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello!
I'm trying to count all the departaments that satisfies a condition. This is the condition:
if(( AVG(STANDAR_COST)
-
((NUM(SUM({<MONTH={$(=NUM($(=MAX({<ID_CLASS={$(Total_Cost)}>}MONTH)),'00'))}>} BENEFIT) /
SUM({<MONTH={$(=NUM($(=MAX({<ID_CLASS={$(Total_Cost)}>}MONTH)),'00'))}>} HOURS),'###.##0,00'))
))<0,1,0)
Now I would have to get a number that indicates the number of the departaments that satisfies that condition. So I'm doing something like this:
=count({<Departament>} if(( AVG({<Departament>}STANDAR_COST)
-
((NUM(SUM({<Departament>}{<MONTH={$(=NUM($(=MAX({<ID_CLASS={$(Total_Cost)}>}MONTH)),'00'))}>} BENEFIT) /
SUM({<Departament>}{<MONTH={$(=NUM($(=MAX({<ID_CLASS={$(Total_Cost)}>}MONTH)),'00'))}>} HOURS),'###.##0,00'))
))<0,1,0)
But I get the error: nested aggregation not allowed
Any idea? Thank you so much
Try this
Sum(Aggr(
if(( AVG(STANDAR_COST)
-
((NUM(SUM({<MONTH={$(=NUM($(=MAX({<ID_CLASS={$(Total_Cost)}>}MONTH)),'00'))}>} BENEFIT) /
SUM({<MONTH={$(=NUM($(=MAX({<ID_CLASS={$(Total_Cost)}>}MONTH)),'00'))}>} HOURS),'###.##0,00'))
))<0,1,0),
Departament))
Try this
Sum(Aggr(
if(( AVG(STANDAR_COST)
-
((NUM(SUM({<MONTH={$(=NUM($(=MAX({<ID_CLASS={$(Total_Cost)}>}MONTH)),'00'))}>} BENEFIT) /
SUM({<MONTH={$(=NUM($(=MAX({<ID_CLASS={$(Total_Cost)}>}MONTH)),'00'))}>} HOURS),'###.##0,00'))
))<0,1,0),
Departament))