Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Qlik Insider: SaaS capabilities for Data Integration and Analytics, May 25th! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Kain_F
Contributor III
Contributor III

Do while loop with calculation

Hey guys,

 

I am stuck on an assignment 

The issue is as following:

I need to calculate eacht 10th percentile for a dataset, so i wanted to solve this with a do while loop.

My data looks like this:

 

Table:

load* inline

['Description','Amount'

'XXX',1231

'YYYY',13156

...

]

(delimiter is ',');

 

Let i=0;

do while (i>=0)

fractile(Amount,i) as percentile_i;

let i= i+.1;

Loop

 

I keep getting the error "Unknown statement: fractile(Amount,i)"

 

Thx 

Labels (2)
1 Solution

Accepted Solutions
ArnadoSandoval
Specialist II
Specialist II

Hi @Kain_F 

You can't use the Fractile - script function as you are trying to do in your script, the Fractile applies to a dataset, you can not use it on a single record, or if you do (as I write my reply, I realized it could be possible), you will get misleading results.

Hope this helps,

 

Arnaldo Sandoval
A journey of a thousand miles begins with a single step.

View solution in original post

3 Replies
ArnadoSandoval
Specialist II
Specialist II

Hi @Kain_F 

You can't use the Fractile - script function as you are trying to do in your script, the Fractile applies to a dataset, you can not use it on a single record, or if you do (as I write my reply, I realized it could be possible), you will get misleading results.

Hope this helps,

 

Arnaldo Sandoval
A journey of a thousand miles begins with a single step.
Kain_F
Contributor III
Contributor III
Author

@ArnadoSandoval Thanks,

I solved it by loading a series like this

Percentiles:

load*Inline[

'Percentile'

0.05

0.10

0.15

...

0.95

1.00]

 

Then in the chart i used fractile(amount,percentile) with a table that has percentiles as dimensions and fractiles as measures

ArnadoSandoval
Specialist II
Specialist II

Hi @Kain_F 

I am glad you resolved your issue !!!!

Arnaldo Sandoval
A journey of a thousand miles begins with a single step.