Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello community,
Can I use the Aggr function twice within the same calculation?
Ex: Avg(Aggr(Count(Aggr(If...,Field))))
Note: Message was edited by Community Moderator for clarity.
Yes, you can.
Depends on what you are trying to do. If you want to know if the syntax is allowed, yes it is. But what exactly do you need this for? May be share a sample with your expected output
Ahh, I thought it was wrong and could not be used 2 times, as it gave me error, invalid function. I'll keep trying and if not inform you and explain the function and related fields.
Thanks you.
Maybe we can help you better if you post the full expression.
Advanced aggregation always shows a single expression and one or more dimension fields as arguments to aggr() function.
Hi swuehl,
Step formula here where I have the inchoerencia: Avg (Aggr (Count (Aggr (If (Sum (VALO)> 0, DOC_CLI), DOC_CLI)) * COUNT (DISTINCT DATE))).
So yes I instead works: Count (Aggr (If (Sum (VALO)> 0, DOC_CLI), DOC_CLI)) * COUNT (DISTINCT DATE)
I need to average this.
This is why we consult them if they could include two Aggr, how can I fix it?
Hi Sunny, Step formula here where I have the inchoerencia: Avg (Aggr (Count (Aggr (If (Sum (VALO)> 0, DOC_CLI), DOC_CLI)) * COUNT (DISTINCT DATE))).
So yes I instead works: Count (Aggr (If (Sum (VALO)> 0, DOC_CLI), DOC_CLI)) * COUNT (DISTINCT DATE)
I need to average this.
This is why we consult them if they could include two Aggr, how can I fix it?
I hope to be more explanatory, you can not clearly see the solution in the link you shared me.
How about this:
Sum(Aggr(Count(Aggr(If(Sum(VALO) > 0, DOC_CLI), DOC_CLI)) * Count(DISTINCT DATE), DOC_CLI))
or this:
Sum(Aggr(Count(Aggr(If(Sum(VALO) > 0, DOC_CLI), DOC_CLI, FECHA)) * Count(DISTINCT DATE), DOC_CLI))