Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
peterderrington
Creator II
Creator II

How to calculate Percentile planning on an expression

Hi,

I need to be able to display percentile planning (eg 80%, 90% etc) based on an expression.

For example I currently have a graph which displays the Average length of stay based on a year.

Definition looks like: Avg({<[DOA-Year]={'2016'}>}([Total LOS - Ward 1 till end of NSECH]))

I would like to show a 95 percentile line for this data however I cant seem to work out the syntax.

If I use this definition: Fractile([Total LOS - Ward 1 till end of NSECH],0.95) 

Then it shows the 95 percentile for the 2 years combined (2016 and 2017)

Is there any way to calculate the percentile based on the original expression?

Thanks in advance,

Peter

4 Replies
niclaz79
Partner - Creator III
Partner - Creator III

Hi,

Why don't you use the same set-expression as in your calculation?

Fractile({<[DOA-Year]={'2016'}>}[Total LOS - Ward 1 till end of NSECH],0.95)

peterderrington
Creator II
Creator II
Author

Using that calculation it wont use the average figure for the percentile.

I'll have a look and see if it gives the right figure.

Thanks for the spot.

jonathandienst
Partner - Champion III
Partner - Champion III

To nest the Average inside the Fractile, you will need an Agg() expression. This requires a dimension that will determine how the averages are calculated. Then you can use an expression like

=Fractile(Aggr(Avg({<[DOA-Year]={'2016'}>}([Total LOS - Ward 1 till end of NSECH])), <dimension>))

Where <dimension> is how the averages are calculated and creates the data vector for Fractile().

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
peterderrington
Creator II
Creator II
Author

ok........

So what do I need to put in <dimension>?

Sorry for asking an obvious question, im going to claim man flu and Friday tiredness for my inability to think today.