Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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')))
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')))
Thanks in advance
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.
Thank you for all your help, Truly i am grateful.