<?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: Sum Conditional Set in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Sum-Conditional-Set/m-p/462499#M1151748</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt; Sum( {1&amp;lt; item_cd = P({&amp;lt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;doc_type={"Purchase"}, doc_status = {"OPEN"}&amp;gt;}[&lt;/SPAN&gt;mainrawmat_cd])&amp;gt;}&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-size: 10pt; color: #737373; font-family: Arial;"&gt; [quantity - deliv_qt] ) &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 May 2013 13:19:30 GMT</pubDate>
    <dc:creator>er_mohit</dc:creator>
    <dc:date>2013-05-15T13:19:30Z</dc:date>
    <item>
      <title>Sum Conditional Set</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-Conditional-Set/m-p/462498#M1151747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a problem: I have a pivot table where the Dimensions are the following (in order): &lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Main Component (mainrawmat_cd)&lt;/LI&gt;&lt;LI&gt;Item (item_cd)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The report gets the information from a table where we have the movement of the items (purchase/sales/stock movement/etc).&lt;/P&gt;&lt;P&gt;Each row of the movement table has it's values according to the item, which could be the main component of other items.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem is that I want the report to have the quantity of items purchased for each Main Component, along with the quantity sold for each Item.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the information table doesn't separate which items are Main Components. They are all Items. There is a column in the information table that shows the Main component of each item.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried the following expression:&amp;nbsp; Sum( {$&amp;lt;doc_type={"Purchase"}, doc_status = {"OPEN"}, item_cd = {mainrawmat_cd}&lt;SPAN style="font-size: 10pt;"&gt;&amp;gt;} ( quantity - deliv_qt ) )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;But it's still wrong...&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Is it ok to compare 2 dimensions in the conditions?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Is there anyway to cancel the intrinsic condition of each row (where it sums for item_cd) and show the sum of any given condition? (in this case, where item_cd = mainrawmat_cd )&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2013 12:59:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-Conditional-Set/m-p/462498#M1151747</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-05-15T12:59:28Z</dc:date>
    </item>
    <item>
      <title>Re: Sum Conditional Set</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-Conditional-Set/m-p/462499#M1151748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt; Sum( {1&amp;lt; item_cd = P({&amp;lt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;doc_type={"Purchase"}, doc_status = {"OPEN"}&amp;gt;}[&lt;/SPAN&gt;mainrawmat_cd])&amp;gt;}&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-size: 10pt; color: #737373; font-family: Arial;"&gt; [quantity - deliv_qt] ) &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2013 13:19:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-Conditional-Set/m-p/462499#M1151748</guid>
      <dc:creator>er_mohit</dc:creator>
      <dc:date>2013-05-15T13:19:30Z</dc:date>
    </item>
    <item>
      <title>Re: Sum Conditional Set</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-Conditional-Set/m-p/462500#M1151749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If item_cd is the primary key of your table then this should work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;Sum( {$&amp;lt;doc_type={"Purchase"}, doc_status = {"OPEN"}, item_cd = {'=&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;item_cd&lt;/SPAN&gt;=mainrawmat_cd'}&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-size: 10pt; color: #737373; font-family: Arial;"&gt;&amp;gt;} ( quantity - deliv_qt ) )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it isn't you could try creating a new field in the script: &lt;EM&gt;recno() as rowid&lt;/EM&gt; and use that new field in the expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;Sum( {$&amp;lt;doc_type={"Purchase"}, doc_status = {"OPEN"}, &lt;STRONG&gt;rowid&lt;/STRONG&gt; = {'=&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;item_cd&lt;/SPAN&gt;=mainrawmat_cd'}&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-size: 10pt; color: #737373; font-family: Arial;"&gt;&amp;gt;} ( quantity - deliv_qt ) )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise you'll have to use an if statement for the intra-record comparison.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2013 14:41:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-Conditional-Set/m-p/462500#M1151749</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-05-15T14:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: Sum Conditional Set</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-Conditional-Set/m-p/462501#M1151750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for the replies, but they still don't fix my problem... &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/sad.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll give an example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Item_cd = 11111 and item_cd = 22222 have mainrawmat_cd = 55555.&lt;/LI&gt;&lt;LI&gt;Item_cd = 55555 has mainrawmat_cd = 55555.&lt;/LI&gt;&lt;LI&gt;Item_cd 11111 has been sold 5 different times, let's say quantity = 20 for each time/row. &lt;/LI&gt;&lt;LI&gt;Item_cd 22222 has been sold 3 different times, let's say quantity = 15 for each time/row. &lt;/LI&gt;&lt;LI&gt;Item_cd 55555 (which is item_cd 11111's and item_cd 22222's mainrawmat_cd) has been purchased 2 times, let's say quantity = 40 and deliv_qt = 10. &lt;/LI&gt;&lt;LI&gt;*Remember these are 10 different rows in the information table.&lt;/LI&gt;&lt;LI&gt;*Item_cd is the primary key for this pivot table. In other words, the information is displayed according to item_cd.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now on the pivot table, in the same row, I'd like to see:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mainrawmat_cd&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; item_cd&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; quantity sold(for item_cd)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; quantity purchased(for mainrawmat_cd)&lt;/P&gt;&lt;P&gt;55555&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 100&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 60&lt;/P&gt;&lt;P&gt;55555&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 22222&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 45&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 60&lt;/P&gt;&lt;P&gt;55555&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 55555&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 60&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it a little bit clearer how the information is arranged?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I use the suggested solutions mentioned above, they only work if i have mainrawmat_cd 55555 and item_cd 55555 on the same row (3rd row in the example). The other rows remain 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2013 15:09:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-Conditional-Set/m-p/462501#M1151750</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-05-15T15:09:27Z</dc:date>
    </item>
  </channel>
</rss>

