<?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-function if ... in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Sum-function-if/m-p/1601793#M737809</link>
    <description>&lt;P&gt;I&amp;nbsp;think the quotes do need to be there, but I think the brackets aren't quite right either. Since you don't close the brackets after 'MPS_productionorderitem.axisdefect', I think it's trying to apply the set analysis to both MPS_productionorderitem.axisdefect&amp;nbsp;and MPS_productionstatistic.ok, and I'm not sure whether that's possible or what you want to be doing here.&lt;/P&gt;&lt;P&gt;On the other hand, if your requirement is simply something along the lines of 'sum the amount of items that were on an order that got cancelled', if your data model is correct, shouldn't you just be able to do something along the lines of Sum( { &amp;lt;MPS_productionorderitem.state={'CANCELED'} &amp;gt; }&amp;nbsp; &amp;lt;ProductionAmountField&amp;gt;)?&lt;/P&gt;&lt;P&gt;Sorry if I'm misunderstanding your requirement or data model, would you be able to upload your application (if necessary with dummy data)? That would make it a lot easier to find a solution for you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Jul 2019 11:30:49 GMT</pubDate>
    <dc:creator>jensmunnichs</dc:creator>
    <dc:date>2019-07-12T11:30:49Z</dc:date>
    <item>
      <title>Sum-function if ...</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-function-if/m-p/1599858#M737803</link>
      <description>&lt;P&gt;Hello everybody,&lt;/P&gt;&lt;P&gt;i want to sum up all&lt;SPAN&gt;&amp;nbsp;defective products in the production.&amp;nbsp;&amp;nbsp;To determine that an order is defective, the description "CANCELED" must be assigned to the order number. If an error exists, a 1 is stored for this cause of the error. Then 1 is to be multiplied by the number of pieces produced.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My formula:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;sum({&amp;lt;MPS_productionorderitem.state={CANCELED}&amp;gt;}(MPS_productionorderitem.axisdefect*(MPS_productionstatistic.ok)))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But it doesn't work. Does anybody has an idea?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;best regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Dominic&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 20:30:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-function-if/m-p/1599858#M737803</guid>
      <dc:creator>dominicanlauf</dc:creator>
      <dc:date>2024-11-16T20:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: Sum-function if ...</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-function-if/m-p/1599863#M737804</link>
      <description>&lt;P&gt;&lt;SPAN&gt;sum({&amp;lt;MPS_productionorderitem.state={CANCELED}&amp;gt;}(MPS_productionorderitem.axisdefec&lt;FONT size="5" color="#FF0000"&gt;t*(&lt;/FONT&gt;MPS_productionstatistic.ok)))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Are you missing a " ) "?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 11:51:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-function-if/m-p/1599863#M737804</guid>
      <dc:creator>gf</dc:creator>
      <dc:date>2019-07-08T11:51:27Z</dc:date>
    </item>
    <item>
      <title>Re: Sum-function if ...</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-function-if/m-p/1599910#M737805</link>
      <description>&lt;P&gt;No, unfortunately not.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Dominic&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 13:15:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-function-if/m-p/1599910#M737805</guid>
      <dc:creator>dominicanlauf</dc:creator>
      <dc:date>2019-07-08T13:15:23Z</dc:date>
    </item>
    <item>
      <title>Re: Sum-function if ...</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-function-if/m-p/1599952#M737806</link>
      <description>&lt;P&gt;I believe you need single quotes around CANCELED. So:&lt;/P&gt;&lt;P&gt;sum({&amp;lt;MPS_productionorderitem.state={'CANCELED'}&amp;gt;}(MPS_productionorderitem.axisdefect*(MPS_productionstatistic.ok)))&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 14:09:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-function-if/m-p/1599952#M737806</guid>
      <dc:creator>lockematthewp</dc:creator>
      <dc:date>2019-07-08T14:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: Sum-function if ...</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-function-if/m-p/1599956#M737807</link>
      <description>&lt;P&gt;&lt;SPAN&gt;SUM( { &amp;lt;MPS_productionorderitem.state={'CANCELED'} &amp;gt; } MPS_productionorderitem.axisdefect*MPS_productionstatistic.ok)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 14:13:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-function-if/m-p/1599956#M737807</guid>
      <dc:creator>gf</dc:creator>
      <dc:date>2019-07-08T14:13:44Z</dc:date>
    </item>
    <item>
      <title>Re: Sum-function if ...</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-function-if/m-p/1601653#M737808</link>
      <description>&lt;P&gt;I thought the same but it does not work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The formula only works if there isn't the condition&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;MPS_productionorderitem.state={'CANCELED'}.&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If the condition is active the result is always 0.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Do you have another idea?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2019 06:36:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-function-if/m-p/1601653#M737808</guid>
      <dc:creator>dominicanlauf</dc:creator>
      <dc:date>2019-07-12T06:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: Sum-function if ...</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-function-if/m-p/1601793#M737809</link>
      <description>&lt;P&gt;I&amp;nbsp;think the quotes do need to be there, but I think the brackets aren't quite right either. Since you don't close the brackets after 'MPS_productionorderitem.axisdefect', I think it's trying to apply the set analysis to both MPS_productionorderitem.axisdefect&amp;nbsp;and MPS_productionstatistic.ok, and I'm not sure whether that's possible or what you want to be doing here.&lt;/P&gt;&lt;P&gt;On the other hand, if your requirement is simply something along the lines of 'sum the amount of items that were on an order that got cancelled', if your data model is correct, shouldn't you just be able to do something along the lines of Sum( { &amp;lt;MPS_productionorderitem.state={'CANCELED'} &amp;gt; }&amp;nbsp; &amp;lt;ProductionAmountField&amp;gt;)?&lt;/P&gt;&lt;P&gt;Sorry if I'm misunderstanding your requirement or data model, would you be able to upload your application (if necessary with dummy data)? That would make it a lot easier to find a solution for you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2019 11:30:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-function-if/m-p/1601793#M737809</guid>
      <dc:creator>jensmunnichs</dc:creator>
      <dc:date>2019-07-12T11:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: Sum-function if ...</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-function-if/m-p/1601823#M737810</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Samples will be taken for each order. If the samples are at a certain error, a "1" for the error will be deposited (for example, 'MPS_productionorderitem.axisdefect '= 1). This statement just states that there is an error. If the job is additionally 'CANCELED', it means that the error is multiplied by the number of pieces produced ('MPS_productionstatistic.ok') because that number of products has the error.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is it more understandable now?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I posted an example:&amp;nbsp;&lt;A href="https://community.qlik.com/t5/QlikView-Creating-Analytics/Sum-function-under-condition/m-p/1601723#M47308" target="_blank"&gt;https://community.qlik.com/t5/QlikView-Creating-Analytics/Sum-function-under-condition/m-p/1601723#M47308&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2019 12:28:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-function-if/m-p/1601823#M737810</guid>
      <dc:creator>dominicanlauf</dc:creator>
      <dc:date>2019-07-12T12:28:19Z</dc:date>
    </item>
    <item>
      <title>Re: Sum-function if ...</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-function-if/m-p/1601877#M737811</link>
      <description>&lt;P&gt;So are you not just looking for the sum of number of pieces produced where [....defect] = 1 and [...state] = CANCELED? In which case, why not just add both to the set analysis?&lt;/P&gt;&lt;P&gt;In your application, I added a text object with the formula below, and I'm getting 1325 as a result (I used bcdefect instead of axisdefect as your original query will always result in 0 as you discovered in the other thread), which is correct as far as I can tell.&lt;/P&gt;&lt;P&gt;&lt;FONT size="1"&gt;=&lt;/FONT&gt;&lt;FONT size="1" color="#0000ff"&gt;SUM&lt;/FONT&gt;&lt;FONT size="1"&gt;({&amp;lt;&lt;/FONT&gt;&lt;FONT size="1" color="#800000"&gt;MPS_productionorderitem.bcdefect&lt;/FONT&gt;&lt;FONT size="1"&gt;={1}, &lt;/FONT&gt;&lt;FONT size="1" color="#800000"&gt;MPS_productionorderitem.state&lt;/FONT&gt;&lt;FONT size="1"&gt;={'Canceled'}&amp;gt;} &lt;/FONT&gt;&lt;FONT size="1" color="#800000"&gt;MPS_productionstatistic.ok&lt;/FONT&gt;&lt;FONT size="1"&gt;) &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Your solution does actually seem to work, I personally just feel that adding both to the set analysis makes the formula a lot easier to read.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2019 14:26:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-function-if/m-p/1601877#M737811</guid>
      <dc:creator>jensmunnichs</dc:creator>
      <dc:date>2019-07-12T14:26:56Z</dc:date>
    </item>
  </channel>
</rss>

