<?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: Conditional sum in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Conditional-sum/m-p/436487#M487652</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can try using a CROSSTABLE LOAD on your table2, something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;CROSSTABLE (FLAG, VALUE, 2) LOAD [DOC ID], [Customer ID], VR1, VR2, VR3, VR4 resident TABLE2;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;drop table TABLE2;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And maybe create a Key from Customer ID and FLAG to avoid the synth key.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Feb 2013 13:53:42 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2013-02-14T13:53:42Z</dc:date>
    <item>
      <title>Conditional sum</title>
      <link>https://community.qlik.com/t5/QlikView/Conditional-sum/m-p/436483#M487648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everybody.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've got an issue wih a conditional sum where I want to sum a chosen field dependong on the value of another field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;basically, I have the kind of 2 following table :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLE 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" height="49" style="width: 297px; border: 1px solid rgb(0, 0, 0); height: 51px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Customer ID&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;FLAG&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;VR1&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;VR2&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;VR3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;TD&gt;VR4&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLE 2&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" height="68" style="width: 526px; border: 1px solid rgb(0, 0, 0); height: 43px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;DOC ID&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Customer ID&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;VR1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;VR2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;VR3&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;VR4&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;xxxx&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;w&lt;/TD&gt;&lt;TD&gt;x&lt;/TD&gt;&lt;TD&gt;y&lt;/TD&gt;&lt;TD&gt;z&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;yyyyy&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;w&lt;/TD&gt;&lt;TD&gt;x&lt;/TD&gt;&lt;TD&gt;y&lt;/TD&gt;&lt;TD&gt;z&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried that :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum( $(FLAG))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but it doesn't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does one of you have an idea ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Feb 2013 13:21:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Conditional-sum/m-p/436483#M487648</guid>
      <dc:creator />
      <dc:date>2013-02-14T13:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional sum</title>
      <link>https://community.qlik.com/t5/QlikView/Conditional-sum/m-p/436484#M487649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;you can do conditional SUM in this way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum ( {$&amp;lt;[Cumstemer ID]={'A'}&amp;gt;} FLAG)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this way you're going to Sum the field FLAG only for CUSTOMER ID = 'A'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Giampiero&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Feb 2013 13:30:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Conditional-sum/m-p/436484#M487649</guid>
      <dc:creator />
      <dc:date>2013-02-14T13:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional sum</title>
      <link>https://community.qlik.com/t5/QlikView/Conditional-sum/m-p/436485#M487650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your quick answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to give futher details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The resulting expression will be used in a pivot table with one of the dimension beeing the customer ID, in order to have the sum of the appropriate field with respect to the customer id for all customers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So with your expression, I need to have one expression for each customer which is not what I need.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Feb 2013 13:36:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Conditional-sum/m-p/436485#M487650</guid>
      <dc:creator />
      <dc:date>2013-02-14T13:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional sum</title>
      <link>https://community.qlik.com/t5/QlikView/Conditional-sum/m-p/436486#M487651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;could you please tell me wich field you want to Sum and the condition you want to use?&lt;/P&gt;&lt;P&gt;In this way I can help you.&lt;/P&gt;&lt;P&gt;Do you have only Customer Id as dimension in your pivot table ?&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Giampiero&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Feb 2013 13:45:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Conditional-sum/m-p/436486#M487651</guid>
      <dc:creator />
      <dc:date>2013-02-14T13:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional sum</title>
      <link>https://community.qlik.com/t5/QlikView/Conditional-sum/m-p/436487#M487652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can try using a CROSSTABLE LOAD on your table2, something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;CROSSTABLE (FLAG, VALUE, 2) LOAD [DOC ID], [Customer ID], VR1, VR2, VR3, VR4 resident TABLE2;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;drop table TABLE2;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And maybe create a Key from Customer ID and FLAG to avoid the synth key.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Feb 2013 13:53:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Conditional-sum/m-p/436487#M487652</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-02-14T13:53:42Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional sum</title>
      <link>https://community.qlik.com/t5/QlikView/Conditional-sum/m-p/436488#M487653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The resulting pivot table will have the customer ID as 1st dimension and months as 2nd dimension.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I could not have a cross table because normally, at the end I should have one value (VR1 to VR4) associated with one customer ID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Currently, one solution is the following expression, but it's not really smart:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;=&lt;/TD&gt;&lt;TD&gt;if(Flag='VR4', sum( {$&amp;lt;DO_TYPE={'5','6'},[Ligne HT]=-{'0'}&amp;gt;} if([Entete Date Livraison]&amp;lt;='14/02/2013',VR1,VR4)), &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;TD&gt;if(Flag='VR1', sum( {$&amp;lt;DO_TYPE={'5','6'},[Ligne HT]=-{'0'}&amp;gt;} VR1),&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;TD&gt;if(Flag='VR2', sum( {$&amp;lt;DO_TYPE={'5','6'},[Ligne HT]=-{'0'}&amp;gt;} if([Entete Date Livraison]&amp;lt;='14/02/2013',VR1,VR2)),&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;TD&gt;if(Flag='VR3', sum( {$&amp;lt;DO_TYPE={'5','6'},[Ligne HT]=-{'0'}&amp;gt;} if([Entete Date Livraison]&amp;lt;='14/02/2013',VR1,VR3))))))&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Feb 2013 15:12:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Conditional-sum/m-p/436488#M487653</guid>
      <dc:creator />
      <dc:date>2013-02-14T15:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional sum</title>
      <link>https://community.qlik.com/t5/QlikView/Conditional-sum/m-p/436489#M487654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunately, I have an issue with this expression when I want to use it in a chart without the customer ID dimension. In this case I can't have the sum chart.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Feb 2013 13:20:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Conditional-sum/m-p/436489#M487654</guid>
      <dc:creator />
      <dc:date>2013-02-15T13:20:35Z</dc:date>
    </item>
  </channel>
</rss>

