Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

kennethand
New Contributor

Average of fourth quartile

How do I find the average of the fourth quartile?

I can find the fourth quartile point using this expression: Fractile(Q21Num, 0.75).

But how do I get average of the values belonging to the fourth quartile ?

1 Solution

Accepted Solutions

Re: Average of fourth quartile

Try this

AVG({$<[Q21Num] = {">=$(=vFractile)"}>} [Q21Num])

With your variable using an equal sign

=Fractile(Q21Num, 0.75)

11 Replies
tkendrick20
Valued Contributor

Re: Average of fourth quartile

You could try this. Though to make sure you're getting the value you're expecting you may want to so some analysis in Excel as well.

=IF([ValueField]<Fractile([ValueField],0.75),AVG([ValueField]))

Re: Average of fourth quartile

What all are your dimensions where you find the Avg?

Avg(Aggr(Fractile(Q21Num, 0.75), SomeDimensionsHere))

kennethand
New Contributor

Re: Average of fourth quartile

I've actually tried this before posting without any luck. Have you tested it yourself ?

kennethand
New Contributor

Re: Average of fourth quartile

"What all are your dimensions where you find the Avg?"

What do you mean? I'm not sure ...

Re: Average of fourth quartile

You must be calculating your Fractile over a dimension right?

Dim, Fractile

A, 10

b, 20

c, 30

and now you want to find the average? What is this Dim over which you want to calculate the Average?

tkendrick20
Valued Contributor

Re: Average of fourth quartile

I guess you need to define a variable to get it to work.

Variable (called vFractile):

Fractile([ValueField],0.75)


Expression:

AVG({$<[ValueField]={'<$(=vFractile)'}>} [ValueField])

kennethand
New Contributor

Re: Average of fourth quartile

Hmm  - for some reason it's not working for me.

I've have a small testsample looking like this:

RespIDQ21Num
110
220
330
440
550
660
770
880
990
10100

Using this expression: Fractile(Q21Num, 0.75) I get the value 77.5 as the fourth quartile. So far so good. Then I like to measure the average of the fourth quartile - in other words I need to calculate the average of every value higher than my fourth quartile point (77.5):

Average of 80 + 90 + 100 = 90

Please take a look at my qvf file.

Re: Average of fourth quartile

Maybe this is helpful in any way: statistical aggregations - parts between frac 0.1 and 0.9.

- Marcus

Re: Average of fourth quartile

Try this

AVG({$<[Q21Num] = {">=$(=vFractile)"}>} [Q21Num])

With your variable using an equal sign

=Fractile(Q21Num, 0.75)

Community Browser