# 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
Did you mean:
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:

['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)

• ### fractile

1 Solution

Accepted Solutions
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.
3 Replies
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.
Contributor III
Author

Percentiles:

'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

Specialist II

Hi @Kain_F