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
QlikWorld online is next week! REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
wlabarca99
Contributor III
Contributor III

Rank on Percentile

Hello All,

I have a function in which I am calculating In Stock % over a certain period of selected days.  It is currently ranked on the past 45 days of sales and only returns if the items fall in the top 2000 items.  What i need is to rank based on whether an item is in the top 80% of the sales over that same period.


Below is my function:

Sum(Aggr(If(Rank(Sum({1<[ord_dt.autoCalendar.Date]={"<=$(=DATE(MAX([ord_dt.autoCalendar.Date])))>=$(=DATE(MAX([ord_dt.autoCalendar.Date])-45))"},prdct_stus={'ACT'},acct_stus={'Active'}>} ttl_itm_px)) < 2001, COUNT({<[fba_inv_historical.fulfillable_qt]-={0}>}[fba_inv_historical.create_dt.autoCalendar.Date])), asin))

/

(Max([fba_inv_historical.fba_inv_dt.autoCalendar.Date])-Min([fba_inv_historical.fba_inv_dt.autoCalendar.Date])+1)

In plain english, my calculation is the number of days that an item was in stock divided by the total number of days selected...

Please let me know if anyone can help.

Thanks!!!

1 Reply
lfholland
Creator
Creator

I tried an if statement with a different expression and it worked.

=IF(YourExpression >=.8,rank(YourExpression),0)

I hope that helps.