3 Replies Latest reply: Apr 12, 2012 5:07 AM by Ashutosh Paliwal RSS

    Sum with condition

      Hey all,

       

      Im quite new to QlikView, although i am able to setup queries and output some graphs, i am now working on a more detailed view of the data and require some help.

       

      I have a graph in my sheet with a sum of turnover, however i want to show only the sum of the turnover when column TypeRegel = 'Verkoop', i found some material on this subject and created the following expression:

       

      =Sum({$ < Typeregel = {'*Verkoop*'}>} Bedrag)

       

      However the graph does not seem to change when i put this expression in and is still summing the total of all records.

       

      What am i doing wrong?

        • Sum with condition
          Ashutosh Paliwal

          Hi,

          Use double quotes instead of single quotes.

          Sum({$ < Typeregel = {"*Verkoop*"}>} Bedrag)

          Single quotes expect exact values to be passed and double quotes accepts case insensitive wild-card searches.

           

          Just check this and let me know, if it still does not work.

          ..

          Ashutosh

          • Sum with condition
            Iyyappan v

            Hi,

             

                 Use the below expression you will get the exact value.

             

            =Sum({$<Typeregel= {'Verkoop'}>} Bedrag)

             

            Regards,

            Iyyappan

              • Sum with condition
                Ashutosh Paliwal

                Yes,

                =Sum({$<Typeregel= {'Verkoop'}>} Bedrag)

                This will give him sum only for Verkoop  (Case sensitive)

                and this

                Sum({$ < Typeregel = {"*Verkoop*"}>} Bedrag)

                will give him results for all the Typeregel  wherever string Verkoop exists.(Case - insensitive)

                So, if he has a Typeregel as "New Verkoop" and another as "Verkoop".

                he will get sum of both these values but in 1st one he will get only for later one (Verkoop).

                 

                So, It all depends on the requirements but as in his question he has used *Verkoop*, So I had used "*Verkoop*".

                 

                ..

                Ashutosh