Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calulation fractile over values from a field and external functions

Hello,

May be somebody can help me with following - there is a vector with values [1,2,3,4,5]. The objective is to calculate 0.05 percentile over the vector AND max and min values of that vector. In other words, the actual vector is [1,1,2,3,4,5,5].

Below is an example:

DATA1:
load * inline [ vector1
1
2
3
4
5
];

DATA2:
load * inline [ vector2
1
1
2
3
4
5
5
];

Now,

=fractile(vector1, 0.05) returns 1.2

=fractile(vector2, 0.05) returns 1

and of course

=rangefractile(0.05, 1,2,3,4,5) retruns 1.2

=rangefractile(0.05, 1,1,2,3,4,5,5) retrurns 1

The part I'm stuck with is how to calculate fractile over [ vector1, min(vector1), max(vector1) ] in an elegant dynamic way. In other words, how to combine the values from the field vector1 with values of min(vector1) and max(vector1) and pass it to fractile function. The actual vectors are huge with millions of elements and varying aggregation levels so pre-calculation of min and max in script (as it was done in the example) is not an option.

Thank you!

3 Replies
johnw
Champion III
Champion III

This works on a small data set:

rangefractile(0.05,min(vector1),$(=concat(vector1,',')),max(vector1))

But it's not going to scale up to millions of rows. I'm afraid I'm not thinking of anything for that.

Not applicable
Author

John,

thanks for your suggestion - as you have predicted it does not scale at all on the full dataset... it has pretty much killed QV session.

Do you know if there is a way to append a value to output of aggr function somehow?

Thank you!

johnw
Champion III
Champion III


Vitalik wrote:Do you know if there is a way to append a value to output of aggr function somehow?


I poked at it a little bit, but I'm not thinking of a way.