<?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 Sum function within an if condition in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Sum-function-within-an-if-condition/m-p/1182313#M519334</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a field called "Account_Number" and two other fields say "A" and "B". Now the requirement is, I need to calculate amount for the Account numbers. Condition for this is, when the Account_Number= 4300910 , 4300920, 9000405 then, it should check if first four digits of A and B are not equal, if so then only calculate the amount for these account numbers. Whenever first four digits of A and B are equal, we have to ignore that amount. For rest of the Account_Numbers, amount should be calculated without applying the condition for A and&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 377px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl71" width="56"&gt;&lt;/TD&gt;&lt;TD class="xl72" width="56"&gt;A&lt;/TD&gt;&lt;TD class="xl71" style="border-left: none;" width="56"&gt;B&lt;/TD&gt;&lt;TD class="xl72" width="56"&gt;A&lt;/TD&gt;&lt;TD class="xl69" style="border-left: none;" width="64"&gt;B&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="20"&gt;Account_Number&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-left: none;"&gt;5007100&lt;/TD&gt;&lt;TD align="right" class="xl67"&gt;5008100&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-left: none;"&gt;5007100&lt;/TD&gt;&lt;TD align="right" class="xl67"&gt;5007200&lt;/TD&gt;&lt;TD class="xl70" style="border-left: none;"&gt;Report&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl75" height="20"&gt;4101100 (other Account_Number)&lt;/TD&gt;&lt;TD class="xl76" colspan="2" style="border-right: .5pt solid black; border-left: none;"&gt;500&lt;/TD&gt;&lt;TD class="xl76" colspan="2" style="border-right: .5pt solid black; border-left: none;"&gt;500&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-left: none;"&gt;1000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl74" height="20"&gt;&lt;SPAN style="color: #339966;"&gt;4300910&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl78" colspan="2" style="border-right: .5pt solid black; border-left: none;"&gt;500&lt;/TD&gt;&lt;TD class="xl80" colspan="2" style="border-right: .5pt solid black; border-left: none;"&gt;&lt;SPAN style="color: #ff0000;"&gt;500&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD align="right" class="xl73" style="border-top: none; border-left: none;"&gt;500&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried the below expression, but not able to get it work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=if(match(Accounts_Number,'4300910' ,'4300920','9000405'),if(left(A,4)&amp;lt;&amp;gt;left(B,4),sum(Amount)),sum(Amount))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: "Amount" is again an expression provided at the script side (an "if" condition)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help on this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Sep 2016 08:52:26 GMT</pubDate>
    <dc:creator>apoorvasd</dc:creator>
    <dc:date>2016-09-13T08:52:26Z</dc:date>
    <item>
      <title>Sum function within an if condition</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-function-within-an-if-condition/m-p/1182313#M519334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a field called "Account_Number" and two other fields say "A" and "B". Now the requirement is, I need to calculate amount for the Account numbers. Condition for this is, when the Account_Number= 4300910 , 4300920, 9000405 then, it should check if first four digits of A and B are not equal, if so then only calculate the amount for these account numbers. Whenever first four digits of A and B are equal, we have to ignore that amount. For rest of the Account_Numbers, amount should be calculated without applying the condition for A and&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 377px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl71" width="56"&gt;&lt;/TD&gt;&lt;TD class="xl72" width="56"&gt;A&lt;/TD&gt;&lt;TD class="xl71" style="border-left: none;" width="56"&gt;B&lt;/TD&gt;&lt;TD class="xl72" width="56"&gt;A&lt;/TD&gt;&lt;TD class="xl69" style="border-left: none;" width="64"&gt;B&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="20"&gt;Account_Number&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-left: none;"&gt;5007100&lt;/TD&gt;&lt;TD align="right" class="xl67"&gt;5008100&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-left: none;"&gt;5007100&lt;/TD&gt;&lt;TD align="right" class="xl67"&gt;5007200&lt;/TD&gt;&lt;TD class="xl70" style="border-left: none;"&gt;Report&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl75" height="20"&gt;4101100 (other Account_Number)&lt;/TD&gt;&lt;TD class="xl76" colspan="2" style="border-right: .5pt solid black; border-left: none;"&gt;500&lt;/TD&gt;&lt;TD class="xl76" colspan="2" style="border-right: .5pt solid black; border-left: none;"&gt;500&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-left: none;"&gt;1000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl74" height="20"&gt;&lt;SPAN style="color: #339966;"&gt;4300910&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl78" colspan="2" style="border-right: .5pt solid black; border-left: none;"&gt;500&lt;/TD&gt;&lt;TD class="xl80" colspan="2" style="border-right: .5pt solid black; border-left: none;"&gt;&lt;SPAN style="color: #ff0000;"&gt;500&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD align="right" class="xl73" style="border-top: none; border-left: none;"&gt;500&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried the below expression, but not able to get it work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=if(match(Accounts_Number,'4300910' ,'4300920','9000405'),if(left(A,4)&amp;lt;&amp;gt;left(B,4),sum(Amount)),sum(Amount))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: "Amount" is again an expression provided at the script side (an "if" condition)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help on this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Sep 2016 08:52:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-function-within-an-if-condition/m-p/1182313#M519334</guid>
      <dc:creator>apoorvasd</dc:creator>
      <dc:date>2016-09-13T08:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: Sum function within an if condition</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-function-within-an-if-condition/m-p/1182314#M519335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Apoorva,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=sum(aggr(if(match(Accounts_Number,'4300910' ,'4300920','9000405'),if(left(A,4)&amp;lt;&amp;gt;left(B,4),sum(Amount),0),sum(Amount)),Accounts_Number,A,B))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Sep 2016 19:32:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-function-within-an-if-condition/m-p/1182314#M519335</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-13T19:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: Sum function within an if condition</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-function-within-an-if-condition/m-p/1182315#M519336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If what &lt;A href="https://community.qlik.com/people/fernando.vizcaino"&gt;fernando.vizcaino&lt;/A&gt;‌ doesn't work for you, would you be able to provide a sample to look at?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Sep 2016 19:50:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-function-within-an-if-condition/m-p/1182315#M519336</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-09-13T19:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: Sum function within an if condition</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-function-within-an-if-condition/m-p/1182316#M519337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Fernando,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the suggestion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried the expression but unfortunately i am not able to see the desired output for Amount!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anymore suggestions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Sep 2016 05:54:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-function-within-an-if-condition/m-p/1182316#M519337</guid>
      <dc:creator>apoorvasd</dc:creator>
      <dc:date>2016-09-14T05:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: Sum function within an if condition</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-function-within-an-if-condition/m-p/1182317#M519338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAP database is the source system for this. Data are confidential, so i don think i can upload a sample qvw.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/sad.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Sep 2016 06:18:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-function-within-an-if-condition/m-p/1182317#M519338</guid>
      <dc:creator>apoorvasd</dc:creator>
      <dc:date>2016-09-14T06:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: Sum function within an if condition</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-function-within-an-if-condition/m-p/1182318#M519339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Apoorva,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would you be able to create an example of the data structure? So I can examine what went wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fernando V.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Sep 2016 17:05:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-function-within-an-if-condition/m-p/1182318#M519339</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-14T17:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: Sum function within an if condition</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-function-within-an-if-condition/m-p/1182319#M519340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Fernando,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have attached an image which explains the logic in detail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;IMG alt="Sum of Amount Logic.PNG" class="jive-image image-1" src="/legacyfs/online/137529_Sum of Amount Logic.PNG" style="height: 331px; width: 620px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Sep 2016 07:16:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-function-within-an-if-condition/m-p/1182319#M519340</guid>
      <dc:creator>apoorvasd</dc:creator>
      <dc:date>2016-09-15T07:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: Sum function within an if condition</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-function-within-an-if-condition/m-p/1182320#M519341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See the attached qvw&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've altered some data compared to your example in Debit / Credit field for testing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;Fernando V.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Sep 2016 17:19:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-function-within-an-if-condition/m-p/1182320#M519341</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-15T17:19:55Z</dc:date>
    </item>
  </channel>
</rss>

