<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Create Negative Value in Script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Create-Negative-Value-in-Script/m-p/333023#M703664</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could try it like this sample.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 02 Aug 2012 21:42:40 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-08-02T21:42:40Z</dc:date>
    <item>
      <title>Create Negative Value in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Negative-Value-in-Script/m-p/333020#M703661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I am still learning Qlikview and am trying to make sense of the script that our developer created.&amp;nbsp; 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.&amp;nbsp; 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.&amp;nbsp; Right now, it shows all of our items in a transaction report as a unit of "1",&amp;nbsp; even though there are several credits in the report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the section in my script that sets the Revenue Flag, with CR being the Credit:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;*,&lt;/P&gt;&lt;P&gt; IF(Tran_CTranType='CR','1',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; IF(Tran_CTranType='S','1',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF(Tran_CTranType='SC','1',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF(Tran_CTranType='RI','1',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF(Tran_CTranType='RR','1'))))) AS Revenue_Flag;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd appreciate any help.&amp;nbsp; Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Aug 2012 20:16:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Negative-Value-in-Script/m-p/333020#M703661</guid>
      <dc:creator />
      <dc:date>2012-08-01T20:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: Create Negative Value in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Negative-Value-in-Script/m-p/333021#M703662</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;*,&lt;/P&gt;&lt;P&gt;IF(Tran_CTranType='CR','-1',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; IF(Tran_CTranType='S','1',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF(Tran_CTranType='SC','1',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF(Tran_CTranType='RI','1',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF(Tran_CTranType='RR','1'))))) AS Revenue_Flag;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;may be this will help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Best Regards,&lt;/P&gt;&lt;P&gt;Kuldeep Tak&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2012 03:36:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Negative-Value-in-Script/m-p/333021#M703662</guid>
      <dc:creator />
      <dc:date>2012-08-02T03:36:52Z</dc:date>
    </item>
    <item>
      <title>Re: Create Negative Value in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Negative-Value-in-Script/m-p/333022#M703663</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your quick reply!&amp;nbsp; I had tried that before and it still wasn't showing the transaction items as -1 in the report.&amp;nbsp; I have edited the script again to the -1, and here is the expression I'm using to sum the units:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUM({&amp;lt;Revenue_Flag={'-1','1'}&amp;gt;} TranItem_Quantity)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I look at the items listed in the report filtered down to Credits only, I see the units at "1" instead of "-1", but the dollar amounts are in parentheses to indicate a negative amount.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there something else I should be doing in my expression?&amp;nbsp; I am trying my best to figure this out on my own, but I am really stuck on this one (and it's probably an easy fix!)&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2012 21:10:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Negative-Value-in-Script/m-p/333022#M703663</guid>
      <dc:creator />
      <dc:date>2012-08-02T21:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: Create Negative Value in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Negative-Value-in-Script/m-p/333023#M703664</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could try it like this sample.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2012 21:42:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Negative-Value-in-Script/m-p/333023#M703664</guid>
      <dc:creator />
      <dc:date>2012-08-02T21:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: Create Negative Value in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Negative-Value-in-Script/m-p/333024#M703665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you!&amp;nbsp; That did it.&amp;nbsp; I figured it was an easy solution, I'm just not so good with expressions yet!&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2012 21:51:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Negative-Value-in-Script/m-p/333024#M703665</guid>
      <dc:creator />
      <dc:date>2012-08-02T21:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: Create Negative Value in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Negative-Value-in-Script/m-p/333025#M703666</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try using this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUM({&amp;lt;Revenue_Flag={'-1','1'}&amp;gt;} TranItem_Quantity*Revenue_Flag)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Best Regards,&lt;/P&gt;&lt;P&gt;Kuldeep Tak&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2012 07:29:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Negative-Value-in-Script/m-p/333025#M703666</guid>
      <dc:creator />
      <dc:date>2012-08-03T07:29:35Z</dc:date>
    </item>
  </channel>
</rss>

