11 Replies Latest reply: Aug 8, 2017 8:32 AM by Kenneth Andersen

# 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 ?

• ###### 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

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

• ###### 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?

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

• ###### Re: Average of fourth quartile

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

I've have a small testsample looking like this:

 RespID Q21Num 1 10 2 20 3 30 4 40 5 50 6 60 7 70 8 80 9 90 10 100

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

Try this

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

With your variable using an equal sign

=Fractile(Q21Num, 0.75)

• ###### Re: Average of fourth quartile

That should work, I just had my sign backwards in my example.

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

• ###### Re: Average of fourth quartile

Excellent - thanks, it did the trick!

• ###### Re: Average of fourth quartile

What all are your dimensions where you find the Avg?

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