<?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: If statement not working in load script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/If-statement-not-working-in-load-script/m-p/675621#M245287</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Simone,&lt;/P&gt;&lt;P&gt;not sure if I understand the problem quite right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think that you want this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; sum(IF (Month='8' and Year=year(Today(0)), &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; IF(Month&amp;lt;Month(Today()), // Here because Mont = 8 and Year = actual year&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF(TabName = 'CX',&amp;nbsp;&amp;nbsp; CX_Liters,0) , // here because TableName = 'CX'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF (TabName = 'B1',&amp;nbsp;&amp;nbsp; B1_Liters ,&amp;nbsp;&amp;nbsp; // Here because Table Name = 'B1'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF (TabName = 'B0' ,&amp;nbsp;&amp;nbsp; B0_Liters , // Here because TableName = 'B0'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF (TabName = 'B4' ,&amp;nbsp;&amp;nbsp; B4_Liters ,&amp;nbsp; // Here because TableName = 'B4'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF (TabName = 'B3',&amp;nbsp;&amp;nbsp; B3_Liters) // Here because TableName = 'B3'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&amp;nbsp;&amp;nbsp; as Actual_Agoust.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 30 Aug 2014 15:39:18 GMT</pubDate>
    <dc:creator>mrooney</dc:creator>
    <dc:date>2014-08-30T15:39:18Z</dc:date>
    <item>
      <title>If statement not working in load script</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-not-working-in-load-script/m-p/675620#M245286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a script that build some fileds calculating in order to different contition.&lt;/P&gt;&lt;P&gt;I try to do this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD x,y,z,&lt;/P&gt;&lt;P&gt;sum(IF (Month='8' and Year=year(Today(0)),&amp;nbsp; IF(Month&amp;lt;Month(Today()),&amp;nbsp; IF(TabName = 'CX',&amp;nbsp;&amp;nbsp; CX_Liters,0)&amp;nbsp; ,&amp;nbsp; IF (TabName = 'B1',&amp;nbsp;&amp;nbsp; B1_Liters ,&amp;nbsp;&amp;nbsp; IF (TabName = 'B0' ,&amp;nbsp;&amp;nbsp; B0_Liters ,&amp;nbsp; IF (TabName = 'B4' ,&amp;nbsp;&amp;nbsp; B4_Liters ,&amp;nbsp;&amp;nbsp; IF (TabName = 'B3',&amp;nbsp;&amp;nbsp; B3_Liters&amp;nbsp; )&amp;nbsp; )&amp;nbsp; )&lt;/P&gt;&lt;P&gt;)),0)) as Actual_Agoust&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;FROM myqvdfile.qvd&lt;/P&gt;&lt;P&gt;GROUP BY x,y,z&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want this behavior: if the month value is August and year is 2004, then if month value is minor than the actual (in this case August) I want check tableName="CX" and sum CX Liters. Otherwise, if month is not minus of actual month, I want to test Table Name: If B1, then sum B1_Liters, &lt;STRONG&gt;ELSE&lt;/STRONG&gt; if B4 then sum B4 Liters, &lt;STRONG&gt;ELSE&lt;/STRONG&gt; if B3 then sum B3_Liters in this order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My big problem is that the script provide to sum either B1, AND B3, AND B3... while I want that if it finds B1 value it sum only B1_Liters and not others (B4, B3).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me please?&lt;/P&gt;&lt;P&gt;Simone&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Aug 2014 10:36:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-not-working-in-load-script/m-p/675620#M245286</guid>
      <dc:creator>simospa</dc:creator>
      <dc:date>2014-08-30T10:36:56Z</dc:date>
    </item>
    <item>
      <title>Re: If statement not working in load script</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-not-working-in-load-script/m-p/675621#M245287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Simone,&lt;/P&gt;&lt;P&gt;not sure if I understand the problem quite right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think that you want this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; sum(IF (Month='8' and Year=year(Today(0)), &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; IF(Month&amp;lt;Month(Today()), // Here because Mont = 8 and Year = actual year&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF(TabName = 'CX',&amp;nbsp;&amp;nbsp; CX_Liters,0) , // here because TableName = 'CX'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF (TabName = 'B1',&amp;nbsp;&amp;nbsp; B1_Liters ,&amp;nbsp;&amp;nbsp; // Here because Table Name = 'B1'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF (TabName = 'B0' ,&amp;nbsp;&amp;nbsp; B0_Liters , // Here because TableName = 'B0'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF (TabName = 'B4' ,&amp;nbsp;&amp;nbsp; B4_Liters ,&amp;nbsp; // Here because TableName = 'B4'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF (TabName = 'B3',&amp;nbsp;&amp;nbsp; B3_Liters) // Here because TableName = 'B3'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&amp;nbsp;&amp;nbsp; as Actual_Agoust.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Aug 2014 15:39:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-not-working-in-load-script/m-p/675621#M245287</guid>
      <dc:creator>mrooney</dc:creator>
      <dc:date>2014-08-30T15:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: If statement not working in load script</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-not-working-in-load-script/m-p/675622#M245288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thansk Miguel, but it doesn't works... the behaviuor is the same in my original statement.&lt;/P&gt;&lt;P&gt;I want that, if I find B1, it doesn's sum B0, B4, B3 too...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;S.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Aug 2014 16:29:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-not-working-in-load-script/m-p/675622#M245288</guid>
      <dc:creator>simospa</dc:creator>
      <dc:date>2014-08-30T16:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: If statement not working in load script</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-not-working-in-load-script/m-p/675623#M245289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please send me a test example. It seems to me the expression should work..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Aug 2014 17:57:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-not-working-in-load-script/m-p/675623#M245289</guid>
      <dc:creator>mrooney</dc:creator>
      <dc:date>2014-08-30T17:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: If statement not working in load script</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-not-working-in-load-script/m-p/675624#M245290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm agree, technically it works as work mine... pheraphs the problem is instead in graph expression, where I use set analisys.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum( {$&amp;lt;year= {$(actual_year)}, Mese = {8}&amp;gt;} actual_agoust)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but I get all the results for August. But I want that, in this order, if sum for tablename=''B1" is zero then get sum for tablename='"B0", if this is zero then get the sum for tablename="B4" and if zero then get sum for tablename="B3".&lt;/P&gt;&lt;P&gt;In this order... exists a way to manage this behaviour with set analysis?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;S.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Aug 2014 18:09:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-not-working-in-load-script/m-p/675624#M245290</guid>
      <dc:creator>simospa</dc:creator>
      <dc:date>2014-08-30T18:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: If statement not working in load script</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-not-working-in-load-script/m-p/675625#M245291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well,&lt;/P&gt;&lt;P&gt;I think that if you want to add amount from different tables, the you'll need to define different accumulaion fields for each one in your script.&lt;/P&gt;&lt;P&gt;After that, in the chart you can manage this situation with set analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12px; background-color: #f6f6f6;"&gt;sum( {$&amp;lt;year= {$(actual_year)}, Mese = {8}&amp;gt;} (If B1Acumm &amp;gt;0, B1Acum, If....., if....))&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Aug 2014 18:23:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-not-working-in-load-script/m-p/675625#M245291</guid>
      <dc:creator>mrooney</dc:creator>
      <dc:date>2014-08-30T18:23:10Z</dc:date>
    </item>
    <item>
      <title>Re: If statement not working in load script</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-not-working-in-load-script/m-p/675626#M245292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nice idea, so I can store value in different columns and use it as you suggest...&lt;/P&gt;&lt;P&gt;I'll try...&lt;/P&gt;&lt;P&gt;Thanks, I tell you asap.&lt;/P&gt;&lt;P&gt;S.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Aug 2014 19:19:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-not-working-in-load-script/m-p/675626#M245292</guid>
      <dc:creator>simospa</dc:creator>
      <dc:date>2014-08-30T19:19:05Z</dc:date>
    </item>
  </channel>
</rss>

