5 Replies Latest reply: Aug 3, 2012 3:29 AM by Chandan Roy RSS

    Create Negative Value in Script

      Hi, I am still learning Qlikview and am trying to make sense of the script that our developer created.  When we have a Credit transaction, the dollar value is listed as a negative in reports I create (that part of our script is working), however if I want to calculate units it is counting the Credit as a positive number and throwing our total unit count off.  I need the Flag below to count the credits as a negative, but still make them visible in a report showing the value as "-1", or whatever the true count would be.  Right now, it shows all of our items in a transaction report as a unit of "1",  even though there are several credits in the report.

       

      Here is the section in my script that sets the Revenue Flag, with CR being the Credit:

       

      LOAD

      *,

      IF(Tran_CTranType='CR','1',

         IF(Tran_CTranType='S','1',

           IF(Tran_CTranType='SC','1',

            IF(Tran_CTranType='RI','1',

             IF(Tran_CTranType='RR','1'))))) AS Revenue_Flag;

       

      I'd appreciate any help.  Thanks!

        • Re: Create Negative Value in Script

          Hi,

           

          you will need to generate the flag in the script as negative for the credit transaction and then you will have to use that flag in your reports as well. I hope you are already doing it in your reports. so you just need to modify your script to make the flag negative when the transaction type is CR. try using below code.

           

          LOAD

          *,

          IF(Tran_CTranType='CR','-1',

             IF(Tran_CTranType='S','1',

               IF(Tran_CTranType='SC','1',

                IF(Tran_CTranType='RI','1',

                 IF(Tran_CTranType='RR','1'))))) AS Revenue_Flag;

           

          may be this will help you.

           

           

          Thanks & Best Regards,

          Kuldeep Tak