5 Replies Latest reply: Feb 3, 2015 3:21 AM by Mika Lindman RSS

    Using if-clause to calculate either sum or avg

    Mika Lindman

      Hi,

       

      I'm trying to calculate sum or average of values on the same column/expression using if-clause. For some reason this gives me wrong results.

       

      if(wildmatch(UnitDesc, '*xyz*') = 0,

      sum(),

      avg()

      )

      UnitDesc is used as a dimension, so each row should only contain sum or avg calculations, never both on the same row. What is the correct way of doing this in Qlikview?