Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
BN
Contributor II
Contributor II

Fractile/percentages

Hi all. I am hoping to get some solution on this. 

 I am trying to calculate fractile/quantiles for my data per year but for specific data category per year. If in my set analysis i add the category i don't get a result even though i get an ok . I tried with Aggr(sum but still no result.

1.

if(aggr(sum({$<data_category = {'GEN'}>}po_amount),year<=(Fractile( total (Aggr(sum({$<data_category = {'GEN'}>}po_amount),year, 0.25), 'Quartile 1',
if(aggr(sum({$<data_category = {'GEN'}>}po_amount),year<=(Fractile( total (Aggr(sum({$<data_category = {'GEN'}>}po_amount),year, 0.50), 'Quartile 2',
//iF (po_amount<=Fractile(Total po_amount, 0.75), 'Quartile 3',
'Quartile 4'))))))))))

2.

=if(sum({$<data_category = {'GEN'}>}po_amount), year<=Fractile( Total {$<data_category = {'GEN'}>}po_amount,0.25),'Quartile 1',
if(sum({$<data_category = {'GEN'}>}po_amount), year<=Fractile(Total {$<data_category = {'GEN'}>}po_amount,0.50), 'Quartile 2',
if(sum({$<data_category = {'GEN'}>}po_amount), year<=Fractile(Total {$<data_category = {'GEN'}>}po_amount,0.75), 'Quartile 3',
'Quartile 4')))

BN_0-1646245099689.png

but i do get a result with this , 

//iF (po_amount<=Fractile(Total po_amount, 0.25), 'Quartile 1',
//iF (po_amount<=Fractile(Total po_amount, 0.50), 'Quartile 2',
//iF (po_amount<=Fractile(Total po_amount, 0.75), 'Quartile 3',
//iF (po_amount>=Fractile(Total po_amount, year, 0.75), 'Quartile 4'))))
//'Quartile 4')))

BN_1-1646245634388.png

 Thanks in advance

11 Replies
Or
MVP
MVP

For any given combination of dimension values in your object, there is only one resulting sum({$<data_category = {'GEN'}>}po_amount) and only one value for sum (Total ({$<data_category = {'GEN'}>}po_amount). You can't generate fractiles based on a single value. As I explained in a previous post, you would likely need to use an internal aggr() to create an array of values broken down by the appropriate dimension(s). I haven't personally tried to use fractile() in this manner but I think it should work.

BN
Contributor II
Contributor II
Author

Thank you for all your help, Truly i am grateful.