Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
kennethand
Contributor III
Contributor III

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
sunny_talwar

Try this

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

With your variable using an equal sign

=Fractile(Q21Num, 0.75)

View solution in original post

11 Replies
TKendrick20
Partner - Specialist
Partner - Specialist

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]))

sunny_talwar

What all are your dimensions where you find the Avg?

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

kennethand
Contributor III
Contributor III
Author

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

kennethand
Contributor III
Contributor III
Author

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

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

sunny_talwar

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
Partner - Specialist
Partner - Specialist

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
Contributor III
Contributor III
Author

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.

marcus_sommer

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

- Marcus

sunny_talwar

Try this

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

With your variable using an equal sign

=Fractile(Q21Num, 0.75)