Announcements
cancel
Showing results for
Did you mean:
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!!!