0 Replies Latest reply: Jul 28, 2013 3:40 PM by Amit Gupta RSS

    Getting count based on an expression



      In the below expression I am trying to find the count of distinct products for which % Change in Cost is >=0.



      COUNT({<Product={"=if((Sum( {1<Product=p(Product)>} Cost) -

      Sum( {1<Product=p(Product)>} Cost_Change))=0,0,

      Sum( {1<Product=p(Product)>} Cost_Change)/

      (Sum( {1<Product=p(Product)>} Cost) -

      Sum( {1<Product=p(Product)>} Cost_Change)))>=0"
      } >} DISTINCT Product)


      But this expression is not returning a correct value if denominator is zero ie if


      Sum( {1<Product=p(Product)>} Cost) -


      Sum( {1<Product=p(Product)>} Cost_Change)=0