Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

and_stepanyan
New Contributor

How to compute the number of elements above group's mean value?

How is it possible to compute the number of elements (observations) above each group's mean value. The table or chart should show for each category/group the number of observations which are above of mean of the categrory (Attention: Not the overall mean of all categories). There are more than one category in the dataset I am working on.

I tried to use the following code to achieve the desired result:

=aggr(Count({<pb={">= $(=avg(pb))"}>}[key.ID]), type)

or

=Count({<pb={">=$(=avg({1} total pb))"}>} [key.ID])

Unfortunately, both codes compute as compared with the overall mean.

Any help would be highly appreciated. Many thanks in advance.

1 Solution

Accepted Solutions
MVP
MVP

Re: How to compute the number of elements above group's mean value?

Maybe something like

=Sum( Aggr( If( pb >= Avg(TOTAL<type> pb),1,0), type, [key.ID]))

2 Replies
MVP
MVP

Re: How to compute the number of elements above group's mean value?

Maybe something like

=Sum( Aggr( If( pb >= Avg(TOTAL<type> pb),1,0), type, [key.ID]))

and_stepanyan
New Contributor

Re: How to compute the number of elements above group's mean value?

it worked fantastic! Many thanks Stefan!

Community Browser