<?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: Nested if help in edit script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Nested-if-help-in-edit-script/m-p/117607#M18115</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are at least two things that doesn't make much sense in the logic:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;The first condition and the second condition will always be satisfied since they are opposite conditions. One of the two will always be true so none of the conditions after the two will ever be tested at all.&lt;/LI&gt;&lt;LI&gt;What will be calculated by any of the first two conditions will be exactly the same since the expression after the condition is the same for both.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;My &lt;STRONG&gt;&lt;EM&gt;guess&lt;/EM&gt;&lt;/STRONG&gt; without knowing what you want to calculate here is that the second line overstriked in red should be removed completely. &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;if(Previous(Key_EMS) &amp;lt;&amp;gt; Key_EMS,($(MonthDiff(Technical_Start_Date, Calendar_Month_Code))),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: line-through;"&gt;&lt;SPAN style="color: #ff0000; text-decoration: line-through;"&gt;if(Previous(Key_EMS) = Key_EMS,($(MonthDiff(Technical_Start_Date, Calendar_Month_Code))),&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;if(Previous(Install_Flag) = 1 and Previous(Removal_Flag) = 1, 0,&lt;/P&gt;&lt;P&gt;if(Previous(Install_Flag) = 1 and Previous(Removal_Flag) = 0, rangesum(peek('Age'),1),&lt;/P&gt;&lt;P&gt;if(Previous(Install_Flag) = 0 and Previous(Removal_Flag) = 1, 0,&lt;/P&gt;&lt;P&gt;if(Previous(Peek('Age2')) = 0, 0, Rangesum(Peek('Age2'),1)))))) &lt;SPAN style="color: #ff0000; text-decoration: line-through;"&gt;)&lt;/SPAN&gt; as Age2&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Note that you will also have to remove a paranthesis at the end before the "as Age2".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Sep 2018 05:45:53 GMT</pubDate>
    <dc:creator>petter</dc:creator>
    <dc:date>2018-09-12T05:45:53Z</dc:date>
    <item>
      <title>Nested if help in edit script</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-if-help-in-edit-script/m-p/117606#M18114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 28.6924px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 28.6924px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;I have the below if else condition written in edit script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 28.6924px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if(Previous(Key_EMS) &amp;lt;&amp;gt; Key_EMS,($(MonthDiff(Technical_Start_Date, Calendar_Month_Code))),&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 28.6924px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if(Previous(Key_EMS) = Key_EMS,($(MonthDiff(Technical_Start_Date, Calendar_Month_Code))),&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 28.6924px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if(Previous(Install_Flag) = 1 and Previous(Removal_Flag) = 1, 0,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 28.6924px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if(Previous(Install_Flag) = 1 and Previous(Removal_Flag) = 0, rangesum(peek('Age'),1),&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 28.6924px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if(Previous(Install_Flag) = 0 and Previous(Removal_Flag) = 1, 0,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 28.6924px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if(Previous(Peek('Age2')) = 0, 0, Rangesum(Peek('Age2'),1))))))) as Age2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 28.6924px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;The first 2 if conditions are working fine but from the third line it is not working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 28.6924px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Can you please help me what is going wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 28.6924px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Thanks,&lt;/P&gt;&lt;P style="font-size: 28.6924px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Bharat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Sep 2018 02:55:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-if-help-in-edit-script/m-p/117606#M18114</guid>
      <dc:creator>bharatkishore</dc:creator>
      <dc:date>2018-09-12T02:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: Nested if help in edit script</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-if-help-in-edit-script/m-p/117607#M18115</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are at least two things that doesn't make much sense in the logic:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;The first condition and the second condition will always be satisfied since they are opposite conditions. One of the two will always be true so none of the conditions after the two will ever be tested at all.&lt;/LI&gt;&lt;LI&gt;What will be calculated by any of the first two conditions will be exactly the same since the expression after the condition is the same for both.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;My &lt;STRONG&gt;&lt;EM&gt;guess&lt;/EM&gt;&lt;/STRONG&gt; without knowing what you want to calculate here is that the second line overstriked in red should be removed completely. &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;if(Previous(Key_EMS) &amp;lt;&amp;gt; Key_EMS,($(MonthDiff(Technical_Start_Date, Calendar_Month_Code))),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: line-through;"&gt;&lt;SPAN style="color: #ff0000; text-decoration: line-through;"&gt;if(Previous(Key_EMS) = Key_EMS,($(MonthDiff(Technical_Start_Date, Calendar_Month_Code))),&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;if(Previous(Install_Flag) = 1 and Previous(Removal_Flag) = 1, 0,&lt;/P&gt;&lt;P&gt;if(Previous(Install_Flag) = 1 and Previous(Removal_Flag) = 0, rangesum(peek('Age'),1),&lt;/P&gt;&lt;P&gt;if(Previous(Install_Flag) = 0 and Previous(Removal_Flag) = 1, 0,&lt;/P&gt;&lt;P&gt;if(Previous(Peek('Age2')) = 0, 0, Rangesum(Peek('Age2'),1)))))) &lt;SPAN style="color: #ff0000; text-decoration: line-through;"&gt;)&lt;/SPAN&gt; as Age2&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Note that you will also have to remove a paranthesis at the end before the "as Age2".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Sep 2018 05:45:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-if-help-in-edit-script/m-p/117607#M18115</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2018-09-12T05:45:53Z</dc:date>
    </item>
    <item>
      <title>Re: Nested if help in edit script</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-if-help-in-edit-script/m-p/117608#M18116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Petter,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much for your reply. i guess the order by is making an issue.if am giving the below order by&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Calendar_Month_Code,Key_EMS,Equipment,[Part Group] ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;as per the condition(except for KEY EMS missing all the conditions are going wrong) written whenever removal flag is there instead of getting 0 i am getting continuous number: Image for your reference:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="T.PNG" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/213346_T.PNG" style="height: 114px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But when i change the order by i am getting write numbers for all the conditions except for Key ems missing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;order by Equipment,[Part Group],&amp;nbsp; Key_EMS,Calendar_Month_Code; Below image for reference:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="T.PNG" class="jive-image image-3" src="https://community.qlik.com/legacyfs/online/213350_T.PNG" style="height: 130px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;I am attaching the file for reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please help me with this and change the code accordingly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Sep 2018 06:10:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-if-help-in-edit-script/m-p/117608#M18116</guid>
      <dc:creator>bharatkishore</dc:creator>
      <dc:date>2018-09-12T06:10:20Z</dc:date>
    </item>
  </channel>
</rss>

