13 Replies Latest reply: Sep 8, 2011 4:24 AM by Gabriel Vázquez RSS

    Two prices, choose higher


       

      Hi everybody.

       

      I have a problem with set analysis calculation. There is some articles that more than one purchase price and I need to do calculation higher price, but everything that attemp fails.

      This is the correct expression for articles with a single price purchase:

       

      SUM({<AÑO_HASTA={9999},CARGO_ABONO={0}>}(PRECIO_COMPRA-(PRECIO_COMPRA*DTO/100))*CANTIDAD / IF(CONVERSION=0,1,CONVERSION)

       

      And this is to find the maximum price

       

      SUM({<AÑO_HASTA={9999},CARGO_ABONO={0}>} AGGR(MAX(PRECIO_COMPRA),CODIGO_ARTICULO)-                                                                                     (AGGR(MAX(PRECIO_COMPRA),CODIGO_ARTICULO)*DTO/100) / IF(CONVERSION=0,1,CONVERSION)

       

      Somebody can help me?

        • Two prices, choose higher
          Stefan Wühl

          Gabriel,

           

          not sure if I can help you. What do you mean with "everything that attemp fails". Errors? No Results? wrong results?

           

          Could you clarify what the relation between Precio_compra and codigo_articulo is (N:1, 1:1 etc.?)?

           

          I noticed that the multiplicator CANTIDAD is missing on your second expression, is there a reason for that?

           

          If you could provide a simple example application, I think that would make things easier, too.

           

          Regards,

          Stefan