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

Dynamic Aggr() using Group Dimension

Hi:

Is it possible to use a cycle group dimension in Aggr() function?

I am thinking something like : Avg(Aggr(Sum(fSettlement),GetCurrentField(CycleGroup))).

But it doesn't work.

Do I need to add a dollar sign somewhere?

Thank you very much.

PC

9 Replies
Anonymous
Not applicable
Author

Aggr(Sum(fSettlement),GetCurrentField(CycleGroup)) will work but



Avg(Aggr(Sum(fSettlement),GetCurrentField(CycleGroup))).will not work

Not applicable
Author

Hi Nitin:

Thank you very much for your answer.

Is there any reason why I cannot take the average?

PC

Anonymous
Not applicable
Author

This is because aggregate functions are not allowed in dimensions without AGGR().

Not applicable
Author

Hi Nitin:

What if I want to calculate the average settlements by a field in the cycle group, say consultants.

(I use a settlement flag which takes the value of 1 or 0)

What should I do?

Thanks

PC

Anonymous
Not applicable
Author

Hi,

Checkout  RangeAvg() function. This will help you to sort out your query.

Thanks

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

I think you can do something like this:

     =Avg(Aggr(Sum(fSettlement), $(=GetCurrentField(CycleGroup))))

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
jonathandienst
Partner - Champion III
Partner - Champion III

Here is an example

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Thank you everyone.

I found the solution in the Cookbook.

You need to add "Square Bracket" around the whole dollar sign thing. So it would look like this.

=Avg(Aggr(Sum(fSettlement), [$(=GetCurrentField(CycleGroup))]))

It will have a red line underneath but still saying "Expression OK". Not sure about this.

Thank you.

PC

canmarroig
Partner - Creator
Partner - Creator

Useful!! Tks