<?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 Converting set analysis expression to if statement (edit script window) in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Converting-set-analysis-expression-to-if-statement-edit-script/m-p/1683206#M455810</link>
    <description>&lt;P&gt;Hello Everyone,&lt;/P&gt;&lt;P&gt;I am facing one issue, where my chart keeps refreshing continuously. When i checked i got to know that because I have used complex date expression in my set analysis it is getting refreshed continuously.&lt;/P&gt;&lt;P&gt;I have used the following expression to calculate my data in chart:&lt;/P&gt;&lt;P&gt;=COUNT({&amp;lt;[ProjectDecision]-={'Hold','Kill'},[Stage]-={'Launch'},&lt;BR /&gt;[Status]-={'Closed'},[ModelName]-={'YHE','OPG'},[LaunchDate] ={"&amp;lt;=$(=date#(Now(), 'yyyy-MM-dd'))"}&amp;gt;}&lt;BR /&gt;if(isnull([LaunchDate]),0,1))&lt;BR /&gt;/COUNT(DISTINCT ProjectID)&lt;/P&gt;&lt;P&gt;Can you please help me in converting this expression into Script expression.&lt;/P&gt;&lt;P&gt;I tried the below expression, but it is giving 0 :&lt;/P&gt;&lt;P&gt;Script in Edit Script :&lt;/P&gt;&lt;P&gt;if([ProjectDecision]='Kill',-1,&lt;BR /&gt;if([ProjectDecision]='Hold',-1,&lt;BR /&gt;if(Stage='Launch/Tracking',-1,&lt;BR /&gt;if(alt(if([ModelName]&amp;lt;&amp;gt;'YHE','',0),if([ModelName]&amp;lt;&amp;gt;'OPG','',0),1)=1,-1,&lt;BR /&gt;if([Status]='Closed',-1,&lt;BR /&gt;if(alt(date([LaunchDate]),'')='',-1,if(num(date([LaunchDate]))-num(date(Today()))&amp;lt;0,1,0&lt;BR /&gt;))))))) as ABC&lt;/P&gt;&lt;P&gt;Script in Chart (set analysis) :&lt;/P&gt;&lt;P&gt;=if(Count(if(ProjectID&amp;gt;0,if(ABC&amp;gt;=0,ProjectID)))=0,'',count(if(ProjectID&amp;gt;0,if(ABC&amp;gt;=0,ABC)))/Count(if(ABC&amp;gt;=0,ProjectID)))&lt;/P&gt;&lt;P&gt;Please let me know if you require any more information.&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Shubhangi&lt;/P&gt;</description>
    <pubDate>Tue, 10 Mar 2020 10:42:26 GMT</pubDate>
    <dc:creator>Shubhangi_01</dc:creator>
    <dc:date>2020-03-10T10:42:26Z</dc:date>
    <item>
      <title>Converting set analysis expression to if statement (edit script window)</title>
      <link>https://community.qlik.com/t5/QlikView/Converting-set-analysis-expression-to-if-statement-edit-script/m-p/1683206#M455810</link>
      <description>&lt;P&gt;Hello Everyone,&lt;/P&gt;&lt;P&gt;I am facing one issue, where my chart keeps refreshing continuously. When i checked i got to know that because I have used complex date expression in my set analysis it is getting refreshed continuously.&lt;/P&gt;&lt;P&gt;I have used the following expression to calculate my data in chart:&lt;/P&gt;&lt;P&gt;=COUNT({&amp;lt;[ProjectDecision]-={'Hold','Kill'},[Stage]-={'Launch'},&lt;BR /&gt;[Status]-={'Closed'},[ModelName]-={'YHE','OPG'},[LaunchDate] ={"&amp;lt;=$(=date#(Now(), 'yyyy-MM-dd'))"}&amp;gt;}&lt;BR /&gt;if(isnull([LaunchDate]),0,1))&lt;BR /&gt;/COUNT(DISTINCT ProjectID)&lt;/P&gt;&lt;P&gt;Can you please help me in converting this expression into Script expression.&lt;/P&gt;&lt;P&gt;I tried the below expression, but it is giving 0 :&lt;/P&gt;&lt;P&gt;Script in Edit Script :&lt;/P&gt;&lt;P&gt;if([ProjectDecision]='Kill',-1,&lt;BR /&gt;if([ProjectDecision]='Hold',-1,&lt;BR /&gt;if(Stage='Launch/Tracking',-1,&lt;BR /&gt;if(alt(if([ModelName]&amp;lt;&amp;gt;'YHE','',0),if([ModelName]&amp;lt;&amp;gt;'OPG','',0),1)=1,-1,&lt;BR /&gt;if([Status]='Closed',-1,&lt;BR /&gt;if(alt(date([LaunchDate]),'')='',-1,if(num(date([LaunchDate]))-num(date(Today()))&amp;lt;0,1,0&lt;BR /&gt;))))))) as ABC&lt;/P&gt;&lt;P&gt;Script in Chart (set analysis) :&lt;/P&gt;&lt;P&gt;=if(Count(if(ProjectID&amp;gt;0,if(ABC&amp;gt;=0,ProjectID)))=0,'',count(if(ProjectID&amp;gt;0,if(ABC&amp;gt;=0,ABC)))/Count(if(ABC&amp;gt;=0,ProjectID)))&lt;/P&gt;&lt;P&gt;Please let me know if you require any more information.&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Shubhangi&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 10:42:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Converting-set-analysis-expression-to-if-statement-edit-script/m-p/1683206#M455810</guid>
      <dc:creator>Shubhangi_01</dc:creator>
      <dc:date>2020-03-10T10:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: Converting set analysis expression to if statement (edit script window)</title>
      <link>https://community.qlik.com/t5/QlikView/Converting-set-analysis-expression-to-if-statement-edit-script/m-p/1683213#M455811</link>
      <description>&lt;P&gt;How about this?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Load ProjectDecision,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Stage,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Status,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;ModelName,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;LaunchDate,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;ProjectID&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;From Table;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Left Join (Table)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Load LaunchDate,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Count(If(IsNull(LaunchDate),0,1))/Count(ProjectID) as Count_Form&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Resident Table Where Not Match(ProjectDecision,'Hold','Kill') and Stage&amp;lt;&amp;gt;'Launch' and Status&amp;lt;&amp;gt;'Closed' and Not Match(ModelName, 'YHE', 'OPG') Group By LaunchDate;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 10:54:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Converting-set-analysis-expression-to-if-statement-edit-script/m-p/1683213#M455811</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2020-03-10T10:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: Converting set analysis expression to if statement (edit script window)</title>
      <link>https://community.qlik.com/t5/QlikView/Converting-set-analysis-expression-to-if-statement-edit-script/m-p/1683234#M455812</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thank you for your reply.&lt;/P&gt;&lt;P&gt;I tried your solution, but it is giving me incorrect syntax error.&lt;/P&gt;&lt;P&gt;Is there any other way to solve this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Shubhangi&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 11:43:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Converting-set-analysis-expression-to-if-statement-edit-script/m-p/1683234#M455812</guid>
      <dc:creator>Shubhangi_01</dc:creator>
      <dc:date>2020-03-10T11:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: Converting set analysis expression to if statement (edit script window)</title>
      <link>https://community.qlik.com/t5/QlikView/Converting-set-analysis-expression-to-if-statement-edit-script/m-p/1683304#M455813</link>
      <description>&lt;P&gt;What happens with this:&lt;/P&gt;&lt;P&gt;=COUNT({&amp;lt;[ProjectDecision]-={'Hold','Kill'},[Stage]-={'Launch'},&lt;BR /&gt;[Status]-={'Closed'},[ModelName]-={'YHE','OPG'},[LaunchDate] ={"&amp;lt;=$(=&lt;STRONG&gt;today()&lt;/STRONG&gt;)"}&amp;gt;} &lt;STRONG&gt;[LaunchDate]&lt;/STRONG&gt;)&lt;BR /&gt;/COUNT(DISTINCT ProjectID)&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 13:48:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Converting-set-analysis-expression-to-if-statement-edit-script/m-p/1683304#M455813</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2020-03-10T13:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: Converting set analysis expression to if statement (edit script window)</title>
      <link>https://community.qlik.com/t5/QlikView/Converting-set-analysis-expression-to-if-statement-edit-script/m-p/1683310#M455814</link>
      <description>&lt;P&gt;Hi Marcus,&lt;/P&gt;&lt;P&gt;This is giving me the required data as I want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;SPAN&gt;=COUNT({&amp;lt;[ProjectDecision]-={'Hold','Kill'},[Stage]-={'Launch'},&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[Status]-={'Closed'},[ModelName]-={'YHE','OPG'},[LaunchDate] ={"&amp;lt;=$(=&lt;/SPAN&gt;&lt;STRONG&gt;today()&lt;/STRONG&gt;&lt;SPAN&gt;)"}&amp;gt;}&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;[LaunchDate]&lt;/STRONG&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;/COUNT(DISTINCT ProjectID)&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I want to have the same query in if statement for edit script window, so that i can have the required data while loading itself.&lt;/P&gt;&lt;P&gt;I guess, syntax wise I am going some where wrong into this :&lt;/P&gt;&lt;P&gt;Script in Edit Script :&lt;/P&gt;&lt;P&gt;if([ProjectDecision]='Kill',-1,&lt;BR /&gt;if([ProjectDecision]='Hold',-1,&lt;BR /&gt;if(Stage='Launch/Tracking',-1,&lt;BR /&gt;if(alt(if([ModelName]&amp;lt;&amp;gt;'YHE','',0),if([ModelName]&amp;lt;&amp;gt;'OPG','',0),1)=1,-1,&lt;BR /&gt;if([Status]='Closed',-1,&lt;BR /&gt;if(alt(date([LaunchDate]),'')='',-1,if(num(date([LaunchDate]))-num(date(Today()))&amp;lt;0,1,0&lt;BR /&gt;))))))) as ABC&lt;/P&gt;&lt;P&gt;Script in Chart (set analysis) :&lt;/P&gt;&lt;P&gt;=if(Count(if(ProjectID&amp;gt;0,if(ABC&amp;gt;=0,ProjectID)))=0,'',count(if(ProjectID&amp;gt;0,if(ABC&amp;gt;=0,ABC)))/Count(if(ABC&amp;gt;=0,ProjectID)))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you can find the error, please let me know.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Shubhangi&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 13:58:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Converting-set-analysis-expression-to-if-statement-edit-script/m-p/1683310#M455814</guid>
      <dc:creator>Shubhangi_01</dc:creator>
      <dc:date>2020-03-10T13:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: Converting set analysis expression to if statement (edit script window)</title>
      <link>https://community.qlik.com/t5/QlikView/Converting-set-analysis-expression-to-if-statement-edit-script/m-p/1683351#M455815</link>
      <description>&lt;P&gt;I think it should rather look like:&lt;/P&gt;&lt;P&gt;if(match([ProjectDecision], 'Kill', 'Hold') or&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Stage='Launch/Tracking' or&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; match([ModelName], 'YHE', 'OPG') or&lt;BR /&gt;&amp;nbsp;&amp;nbsp; [Status] = 'Closed' or&lt;BR /&gt;&amp;nbsp;&amp;nbsp; not isnum([LaunchDate]) or&lt;BR /&gt;&amp;nbsp;&amp;nbsp; [LaunchDate] &amp;gt;= Today(), 0, 1) as ABC&lt;/P&gt;&lt;P&gt;Script in Chart (set analysis) :&lt;BR /&gt;&lt;BR /&gt;sum(ABC) / Count(distinct ProjectID)&lt;BR /&gt;&amp;nbsp; or maybe&amp;nbsp;&lt;BR /&gt;count({&amp;gt; ABC = {1}&amp;gt;} [LaunchDate]) / Count(distinct ProjectID)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 14:46:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Converting-set-analysis-expression-to-if-statement-edit-script/m-p/1683351#M455815</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2020-03-10T14:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: Converting set analysis expression to if statement (edit script window)</title>
      <link>https://community.qlik.com/t5/QlikView/Converting-set-analysis-expression-to-if-statement-edit-script/m-p/1683685#M455816</link>
      <description>&lt;P&gt;Hi Marcus,&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;&lt;P&gt;I tried the solution which you gave, but i want to have the ProjectID where all the records having following conditions are excluded.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if([ProjectDecision]='Kill',-1,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if([ProjectDecision]='Hold',-1,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if(Stage='Launch/Tracking',-1,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if(alt(if([ModelName]&amp;lt;&amp;gt;'YHE','',0),if([ModelName]&amp;lt;&amp;gt;'OPG','',0),1)=1,-1,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if([Status]='Closed',-1,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if(alt(date([LaunchDate]),'')='',-1,if(num(date([LaunchDate]))-num(date(Today()))&amp;lt;0,1,0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;))))))) as ABC&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If you observe my script, i am trying to exclude the projects having all this conditions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Can you please help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Shubhangi&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Mar 2020 10:23:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Converting-set-analysis-expression-to-if-statement-edit-script/m-p/1683685#M455816</guid>
      <dc:creator>Shubhangi_01</dc:creator>
      <dc:date>2020-03-11T10:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: Converting set analysis expression to if statement (edit script window)</title>
      <link>https://community.qlik.com/t5/QlikView/Converting-set-analysis-expression-to-if-statement-edit-script/m-p/1683729#M455817</link>
      <description>&lt;P&gt;My suggestion is just the attempt to simplify the approach by conflating the multiple if-loops. I'm not sure if I "translated" your example (did it work?) correctly - but I think you could use it as starting point to develop the flag-field. Before you apply the deduced expression I suggest to use a tablebox with all related fields to check if the logic worked and to make the needed adjustment if it didn't.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Wed, 11 Mar 2020 11:52:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Converting-set-analysis-expression-to-if-statement-edit-script/m-p/1683729#M455817</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2020-03-11T11:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: Converting set analysis expression to if statement (edit script window)</title>
      <link>https://community.qlik.com/t5/QlikView/Converting-set-analysis-expression-to-if-statement-edit-script/m-p/1684043#M455818</link>
      <description>&lt;P&gt;Hi Marcus,&lt;/P&gt;&lt;P&gt;The solution which you gave dint worked. I am getting wrong data.&lt;/P&gt;&lt;P&gt;Can someone please help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Shubhangi&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2020 08:17:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Converting-set-analysis-expression-to-if-statement-edit-script/m-p/1684043#M455818</guid>
      <dc:creator>Shubhangi_01</dc:creator>
      <dc:date>2020-03-12T08:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: Converting set analysis expression to if statement (edit script window)</title>
      <link>https://community.qlik.com/t5/QlikView/Converting-set-analysis-expression-to-if-statement-edit-script/m-p/1684046#M455819</link>
      <description>&lt;P&gt;Did you check the data and the calculated flag within a tablebox? Have you checked the flag-creation and the following expressions partly - maybe it's just a very small issue by one of the parts.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2020 08:47:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Converting-set-analysis-expression-to-if-statement-edit-script/m-p/1684046#M455819</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2020-03-12T08:47:34Z</dc:date>
    </item>
    <item>
      <title>Re: Converting set analysis expression to if statement (edit script window)</title>
      <link>https://community.qlik.com/t5/QlikView/Converting-set-analysis-expression-to-if-statement-edit-script/m-p/1691755#M455820</link>
      <description>&lt;P&gt;Were you able to see if Marcus' last comments helped or not?&amp;nbsp; Please be sure to circle back and close out the thread if you got things sorted or let us know what you still need if you are still working on things.&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Brett&lt;/P&gt;</description>
      <pubDate>Tue, 07 Apr 2020 19:25:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Converting-set-analysis-expression-to-if-statement-edit-script/m-p/1691755#M455820</guid>
      <dc:creator>Brett_Bleess</dc:creator>
      <dc:date>2020-04-07T19:25:28Z</dc:date>
    </item>
    <item>
      <title>Re: Converting set analysis expression to if statement (edit script window)</title>
      <link>https://community.qlik.com/t5/QlikView/Converting-set-analysis-expression-to-if-statement-edit-script/m-p/1692354#M455821</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The solution which Marcus gave dint helped me.&lt;/P&gt;&lt;P&gt;But I did some research and solved it in a different way.&lt;/P&gt;&lt;P&gt;Thank you so much for your help and support.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Shubhangi&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2020 12:53:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Converting-set-analysis-expression-to-if-statement-edit-script/m-p/1692354#M455821</guid>
      <dc:creator>Shubhangi_01</dc:creator>
      <dc:date>2020-04-09T12:53:38Z</dc:date>
    </item>
  </channel>
</rss>

