1 Reply Latest reply: Sep 14, 2012 9:15 AM by michail R RSS

    % availability

      Good afternoon.

      It is necessary to calculate the% availability, ie

      Number of dates where the stock higher than the average sales divided by the number of days in the period, we get% availability

      Average sale is the sum of the last 20 sales division by 20, his status is 1 and a check equal to 1

       

      Should get a table

      SalesMan
      % availability
      Stiv10%
      Ivan58%
      Abram62%


       

       

      Embedded sample data model

       

        • Re: % availability

          The result here is that expression, but it works somehow strange when cleaned selections, the result of an underestimate, as selected seller, all appears fine

          What are some ideas?

           

          Count({$<Count_Stock={">=$(=Sum({<Date={">=$(=

          Date(If(

          IsNull(

          FirstSortedValue({<Count={">0"},Status={"1"},Check={"1"}>}   Date, -Date, 20)),

          Min({<Count={">0"},Status={"1"},Check={"1"}>}Date),

          FirstSortedValue({<Count={">0"},Satus={"1"},Check={"1"}>}  Date, -Date, 20))

          ))"},Count={">0"},Status={"1"},Check1={"1"}>} Count

          )

          /If(

          IsNull(

          FirstSortedValue({<Count={">0"},Status={"1"},Check={"1"}>} Date, -Date, 20)),

          Count({<Date={">=$(=Min({$<Count={">0"},Status={"1"},Check={"1"}>}Date))"},Count={">0"},Status={"1"},Check={"1"}>}distinct Date),20))"}>} DISTINCT Date)

          /

          Count(DISTINCT Date)