<?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 IF not working in qlik sense load script in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/IF-not-working-in-qlik-sense-load-script/m-p/1909648#M74969</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Hoping, someone could help me please. I have been scratching my head on this for last 3 days.&lt;/P&gt;
&lt;P&gt;I have this in my load script:&lt;/P&gt;
&lt;P&gt;MonthList:&lt;/P&gt;
&lt;P&gt;Load&lt;BR /&gt;Evaluate(Transaction_Month) as MonthName&lt;BR /&gt;Inline [&lt;BR /&gt;Transaction_Month&lt;BR /&gt;addmonths('$(start_date_fiscal)',0)&lt;BR /&gt;addmonths('$(start_date_fiscal)',1)&lt;BR /&gt;addmonths('$(start_date_fiscal)',2)&lt;BR /&gt;addmonths('$(start_date_fiscal)',3)&lt;BR /&gt;addmonths('$(start_date_fiscal)',4)&lt;/P&gt;
&lt;P&gt;](delimiter is ';');&lt;/P&gt;
&lt;P&gt;Fiscal1:&lt;BR /&gt;Load num(1) as ID, MonthName, quartername(MonthName,0,1) as Quarter1 resident MonthList;&lt;BR /&gt;Concatenate&lt;BR /&gt;Load num(4) as ID, MonthName, quartername(MonthName,0,4) as Quarter4 resident MonthList;&lt;/P&gt;
&lt;P&gt;NoConcatenate&lt;BR /&gt;FinalFiscal:&lt;/P&gt;
&lt;P&gt;Load &lt;BR /&gt;ID,MonthName,Quarter1,Quarter4, Coalesce(Quarter1,Quarter4) as FinalQuarter&lt;BR /&gt;&lt;BR /&gt;resident Fiscal1;&lt;BR /&gt;drop table Fiscal1;&lt;/P&gt;
&lt;P&gt;The output of this in table is:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Uttamjit_0-1648175398083.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/75307i2C95858F10BB35EC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Uttamjit_0-1648175398083.png" alt="Uttamjit_0-1648175398083.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Somehow, I can't able to get the correct value in FinalQuarter for ID=4.&lt;/P&gt;
&lt;P&gt;I have also tried the IF expression in load script instead of coalesce like, but it still doesn't work&lt;/P&gt;
&lt;P&gt;ID,MonthName,Quarter1,Quarter4, if(ID=4, Quarter4,(IF(ID=1, Quarter1))) ) as FinalQuarter&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 25 Mar 2022 02:32:10 GMT</pubDate>
    <dc:creator>Uttamjit</dc:creator>
    <dc:date>2022-03-25T02:32:10Z</dc:date>
    <item>
      <title>IF not working in qlik sense load script</title>
      <link>https://community.qlik.com/t5/App-Development/IF-not-working-in-qlik-sense-load-script/m-p/1909648#M74969</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Hoping, someone could help me please. I have been scratching my head on this for last 3 days.&lt;/P&gt;
&lt;P&gt;I have this in my load script:&lt;/P&gt;
&lt;P&gt;MonthList:&lt;/P&gt;
&lt;P&gt;Load&lt;BR /&gt;Evaluate(Transaction_Month) as MonthName&lt;BR /&gt;Inline [&lt;BR /&gt;Transaction_Month&lt;BR /&gt;addmonths('$(start_date_fiscal)',0)&lt;BR /&gt;addmonths('$(start_date_fiscal)',1)&lt;BR /&gt;addmonths('$(start_date_fiscal)',2)&lt;BR /&gt;addmonths('$(start_date_fiscal)',3)&lt;BR /&gt;addmonths('$(start_date_fiscal)',4)&lt;/P&gt;
&lt;P&gt;](delimiter is ';');&lt;/P&gt;
&lt;P&gt;Fiscal1:&lt;BR /&gt;Load num(1) as ID, MonthName, quartername(MonthName,0,1) as Quarter1 resident MonthList;&lt;BR /&gt;Concatenate&lt;BR /&gt;Load num(4) as ID, MonthName, quartername(MonthName,0,4) as Quarter4 resident MonthList;&lt;/P&gt;
&lt;P&gt;NoConcatenate&lt;BR /&gt;FinalFiscal:&lt;/P&gt;
&lt;P&gt;Load &lt;BR /&gt;ID,MonthName,Quarter1,Quarter4, Coalesce(Quarter1,Quarter4) as FinalQuarter&lt;BR /&gt;&lt;BR /&gt;resident Fiscal1;&lt;BR /&gt;drop table Fiscal1;&lt;/P&gt;
&lt;P&gt;The output of this in table is:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Uttamjit_0-1648175398083.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/75307i2C95858F10BB35EC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Uttamjit_0-1648175398083.png" alt="Uttamjit_0-1648175398083.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Somehow, I can't able to get the correct value in FinalQuarter for ID=4.&lt;/P&gt;
&lt;P&gt;I have also tried the IF expression in load script instead of coalesce like, but it still doesn't work&lt;/P&gt;
&lt;P&gt;ID,MonthName,Quarter1,Quarter4, if(ID=4, Quarter4,(IF(ID=1, Quarter1))) ) as FinalQuarter&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Mar 2022 02:32:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/IF-not-working-in-qlik-sense-load-script/m-p/1909648#M74969</guid>
      <dc:creator>Uttamjit</dc:creator>
      <dc:date>2022-03-25T02:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: IF not working in qlik sense load script</title>
      <link>https://community.qlik.com/t5/App-Development/IF-not-working-in-qlik-sense-load-script/m-p/1919596#M75668</link>
      <description>&lt;P&gt;Fiscal1:&lt;BR /&gt;Load num(1) as ID, MonthName, quartername(MonthName,0,1) as Quarter1 resident MonthList;&lt;BR /&gt;Concatenate&lt;BR /&gt;Load num(4) as ID, MonthName, quartername(MonthName,0,4) as Quarter4 resident MonthList;&lt;/P&gt;
&lt;P&gt;Your Fiscal table will be as below&lt;/P&gt;
&lt;P&gt;ID&amp;nbsp; &amp;nbsp;|&amp;nbsp; MonthName | Quarter1 | Quarter 4&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1 | 1/1/2019 | Jan-Mar 19 |&amp;nbsp; &amp;nbsp; null&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1 | 1/4/2019 | Apr-Jun 19 |&amp;nbsp; &amp;nbsp; null&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4 | 1/1/2019 |&amp;nbsp; null&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |&amp;nbsp; &amp;nbsp;Jan-Mar 18&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;4 | 1/4/2019 |&amp;nbsp; null&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;nbsp; &amp;nbsp; &amp;nbsp;Apr-Jun 19&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;What is the point in doing coalesce in the above table when either of the two columns will always be null??&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;for num(1) quarter4 will always be null&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;for num(4) quarter1 will always be null&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;you can just do&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Fiscal1:&lt;BR /&gt;Load num(1) as ID, MonthName, quartername(MonthName,0,1) as Quarter1 &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;,quartername(MonthName,0,1) as FinalQuarter&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;resident MonthList;&lt;BR /&gt;Concatenate&lt;BR /&gt;Load num(4) as ID, MonthName, quartername(MonthName,0,4) as Quarter4 &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;,quartername(MonthName,0,4) as FinalQuarter&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;resident MonthList;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 03:38:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/IF-not-working-in-qlik-sense-load-script/m-p/1919596#M75668</guid>
      <dc:creator>vinieme12</dc:creator>
      <dc:date>2022-04-19T03:38:04Z</dc:date>
    </item>
    <item>
      <title>Re: IF not working in qlik sense load script</title>
      <link>https://community.qlik.com/t5/App-Development/IF-not-working-in-qlik-sense-load-script/m-p/1922356#M75922</link>
      <description>&lt;P&gt;Hi Vineeth,&lt;/P&gt;
&lt;P&gt;I originally tried your way only, but it doesn't work. Why I was doing different column names for each load was just another way to get the original problem solved, although couldn't solve it this way too. The problem still stays the same. Somehow, the first 3 statement loads with ID=1,2 and 3 work, but after that&amp;nbsp; the year in the quarter is always incorrect for ID &amp;gt;=4. The statement works if I wrap the quartername formula with text function, but I don't want to do that given then my column doesn't remain a date.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;text&lt;/STRONG&gt;(&lt;STRONG&gt;quartername(MonthName,0,4)&lt;/STRONG&gt;)&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 21:56:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/IF-not-working-in-qlik-sense-load-script/m-p/1922356#M75922</guid>
      <dc:creator>Uttamjit</dc:creator>
      <dc:date>2022-04-25T21:56:58Z</dc:date>
    </item>
    <item>
      <title>Re: IF not working in qlik sense load script</title>
      <link>https://community.qlik.com/t5/App-Development/IF-not-working-in-qlik-sense-load-script/m-p/1922358#M75923</link>
      <description>&lt;P&gt;One more thing, it is not abut the IF function, I guess somehow the quartername function itself is not working for me in the script. Maybe, I am not using it correctly. I am sharing the sample qvf, please have a look at the ID&amp;gt;=4, the quarters look incorrect to me.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 22:12:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/IF-not-working-in-qlik-sense-load-script/m-p/1922358#M75923</guid>
      <dc:creator>Uttamjit</dc:creator>
      <dc:date>2022-04-25T22:12:23Z</dc:date>
    </item>
  </channel>
</rss>

