<?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 Nested if-else into set analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Nested-if-else-into-set-analysis/m-p/147609#M505364</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks John this solution works for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;May I apply a sum to this result in order to get summary?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 Jan 2010 22:31:42 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-01-26T22:31:42Z</dc:date>
    <item>
      <title>Nested if-else into set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-if-else-into-set-analysis/m-p/147602#M505357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;I have following expression :-&lt;BR /&gt;sum(if(some condition,sales,if(some condition,sales))&lt;/P&gt;&lt;P&gt;I want to convert above nested if-else expression into set analysis.&lt;/P&gt;&lt;P&gt;simple if expression can be converted into set analysis very easily.&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Ravish.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2009 13:05:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-if-else-into-set-analysis/m-p/147602#M505357</guid>
      <dc:creator />
      <dc:date>2009-06-24T13:05:41Z</dc:date>
    </item>
    <item>
      <title>Nested if-else into set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-if-else-into-set-analysis/m-p/147603#M505358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm assuming the Sales field would be different for each condition.&lt;/P&gt;&lt;P&gt;This should work:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Sum ({&amp;lt;Field1 = {1}&amp;gt;} Sales1) + Sum ({&amp;lt;Field1 = {'&amp;lt;1&amp;gt;1'}, Field2 = {1}&amp;gt;} Sales2)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;If your values are not numeric, I think you can use this for the not equal portion:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Sum ({&amp;lt;Field1 = {Y}&amp;gt;} Sales1) + Sum ({&amp;lt;Field1 -= {Y}, Field2 = {Y}&amp;gt;} Sales2)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2009 20:46:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-if-else-into-set-analysis/m-p/147603#M505358</guid>
      <dc:creator />
      <dc:date>2009-06-24T20:46:51Z</dc:date>
    </item>
    <item>
      <title>Nested if-else into set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-if-else-into-set-analysis/m-p/147604#M505359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yeah, it would help if we could tell if the conditions are different and/or the sales are different. As written, it's just sum(if(some condition,sales)), which is almost certainly not what you were asking about.&lt;/P&gt;&lt;P&gt;I'm not going to go through all four possibilities, so I'll just give you the rough idea. Set analysis has operators for union and exclusion, and some combination of these are likely what you want. Have a look at the help text for set analysis. Or give an actual example, and we can easily convert it to the set analysis equivalent.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2009 00:28:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-if-else-into-set-analysis/m-p/147604#M505359</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-06-25T00:28:03Z</dc:date>
    </item>
    <item>
      <title>Nested if-else into set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-if-else-into-set-analysis/m-p/147605#M505360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your help.&lt;BR /&gt;I want to convert following nested if-else expression into set analysis :-&lt;/P&gt;&lt;P&gt;=sum(if(F1='FTD',if(year=vIndexYear and Month=vIndexMonth and Day=vIndexDay,amt),&lt;BR /&gt; if(F1='MTD',if(year=vIndexYear and Month=(vIndexMonth) and Day&amp;lt;=vIndexDay,amt),&lt;BR /&gt; if(F1='YTD',if(year=vIndexYear and new&amp;lt;=m,amt)))))&lt;/P&gt;&lt;P&gt;so that my chart will be looked like as follows :-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width:296pt;border-collapse:collapse;" width="392"&gt;&lt;COLGROUP&gt;&lt;COL style="width:74pt;mso-width-source:userset;mso-width-alt:3584;mso-outline-parent:collapsed;" width="98" /&gt;&lt;COL style="width:74pt;mso-width-source:userset;mso-width-alt:3584;mso-outline-parent:collapsed;" width="98" /&gt;&lt;COL style="width:74pt;mso-width-source:userset;mso-width-alt:3584;mso-outline-parent:collapsed;" width="98" /&gt;&lt;COL style="width:74pt;mso-width-source:userset;mso-width-alt:3584;mso-outline-parent:collapsed;" width="98" /&gt;&lt;/COLGROUP&gt;&lt;TBODY&gt;&lt;TR style="height:15.75pt;"&gt;&lt;TD class="xl22" height="21" style="border-right:gainsboro 0.5pt solid;border-top:gainsboro 0.5pt solid;border-left:gainsboro 1pt solid;width:74pt;border-bottom:gainsboro 1pt solid;height:15.75pt;background-color:#ebebeb;" width="98"&gt;&lt;STRONG&gt;F1&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl23" style="border-right:gainsboro 0.5pt solid;border-top:gainsboro 0.5pt solid;border-left:gainsboro;width:74pt;border-bottom:gainsboro 0.5pt solid;background-color:white;" width="98"&gt;FTD&lt;/TD&gt;&lt;TD class="xl23" style="border-right:gainsboro 0.5pt solid;border-top:gainsboro 0.5pt solid;border-left:gainsboro;width:74pt;border-bottom:gainsboro 0.5pt solid;background-color:white;" width="98"&gt;MTD&lt;/TD&gt;&lt;TD class="xl23" style="border-right:gainsboro 0.5pt solid;border-top:gainsboro 0.5pt solid;border-left:gainsboro;width:74pt;border-bottom:gainsboro 0.5pt solid;background-color:white;" width="98"&gt;YTD&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height:15.75pt;"&gt;&lt;TD class="xl24" height="21" style="border-right:gainsboro 1pt solid;border-top:gainsboro 0.5pt solid;border-left:gainsboro 0.5pt solid;border-bottom:gainsboro 1pt solid;height:15.75pt;background-color:silver;"&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl23" style="border-right:gainsboro 0.5pt solid;border-top:gainsboro;border-left:gainsboro 0.5pt solid;border-bottom:gainsboro 0.5pt solid;background-color:white;"&gt;200&lt;/TD&gt;&lt;TD align="right" class="xl23" style="border-right:gainsboro 0.5pt solid;border-top:gainsboro;border-left:gainsboro;border-bottom:gainsboro 0.5pt solid;background-color:white;"&gt;400&lt;/TD&gt;&lt;TD align="right" class="xl23" style="border-right:gainsboro 0.5pt solid;border-top:gainsboro;border-left:gainsboro;border-bottom:gainsboro 0.5pt solid;background-color:white;"&gt;700&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Regards,&lt;BR /&gt;Ravish.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2009 10:57:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-if-else-into-set-analysis/m-p/147605#M505360</guid>
      <dc:creator />
      <dc:date>2009-06-26T10:57:27Z</dc:date>
    </item>
    <item>
      <title>Nested if-else into set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-if-else-into-set-analysis/m-p/147606#M505361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Before we even get into set analysis, you should realize that the IF statement as you wrote it is being evaluated for every row of the table, where part of it really only needs to be evaluated once. So you'd get some improvement by just moving parts of it outside of the sum:&lt;/P&gt;&lt;P&gt;=if(F1='FTD',sum(if(year=vIndexYear and Month=vIndexMonth and Day =vIndexDay,amt))&lt;BR /&gt;,if(F1='MTD',sum(if(year=vIndexYear and Month=vIndexMonth and Day&amp;lt;=vIndexDay,amt))&lt;BR /&gt;,if(F1='YTD',sum(if(year=vIndexYear and new&amp;lt;=m,amt)))))&lt;/P&gt;&lt;P&gt;And that's the basic structure I'd keep when converting to set analysis. I think the set analysis expression would be this (untested):&lt;/P&gt;&lt;P&gt;=if(F1='FTD',sum({&amp;lt;year={$(=vIndexYear)} Month={$(=vIndexMonth)} Day={$(=vIndexDay)}&amp;gt;}amt)&lt;BR /&gt;,if(F1='MTD',sum({&amp;lt;year={$(=vIndexYear)} Month={$(=vIndexMonth)} Day={'&amp;lt;=$(=vIndexDay)'}&amp;gt;}amt)&lt;BR /&gt;,if(F1='YTD',sum({&amp;lt;year={$(=vIndexYear)} new={'&amp;lt;=$(=m)'}&amp;gt;}amt))))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Jun 2009 00:41:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-if-else-into-set-analysis/m-p/147606#M505361</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-06-27T00:41:34Z</dc:date>
    </item>
    <item>
      <title>Nested if-else into set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-if-else-into-set-analysis/m-p/147607#M505362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am new to qlikview and need some help to undestand the syntaxis, I am trying to do a If..else nestled like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*************&lt;/P&gt;&lt;P&gt;IF ( fe_ul_pa - vence_en&amp;gt;=45) then&lt;/P&gt;&lt;P&gt;Tota_PrecioSKU * 10;&lt;/P&gt;&lt;P&gt;elseif (fe_ul_pa - vence_en) &amp;gt;= 41 and (fe_ul_pa - vence_en &amp;lt;= 45) then&lt;/P&gt;&lt;P&gt;Tota_PrecioSKU * 0.5;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;elseif (fe_ul_pa - vence_en) &amp;gt;= 36 and (fe_ul_pa - vence_en) &amp;lt;= 40 then&lt;/P&gt;&lt;P&gt;Tota_PrecioSKU * 0.1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;elseif (fe_ul_pa - vence_en) &amp;gt;= 0 and (fe_ul_pa - vence_en) &amp;lt;= 35 then&lt;/P&gt;&lt;P&gt;Tota_PrecioSKU * 0.2;&lt;/P&gt;&lt;P&gt;end if;&lt;/P&gt;&lt;DIV&gt;**********&lt;/DIV&gt;&lt;DIV&gt;buy i have some errors expression, I will appreciate your help to do in a better simple way, or correct the syntax.&lt;/DIV&gt;&lt;DIV&gt;thx in advanced&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jan 2010 05:33:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-if-else-into-set-analysis/m-p/147607#M505362</guid>
      <dc:creator />
      <dc:date>2010-01-26T05:33:23Z</dc:date>
    </item>
    <item>
      <title>Nested if-else into set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-if-else-into-set-analysis/m-p/147608#M505363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Assuming integer values, which is what it appears you're testing due to the integer gaps in the ranges:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;Tota_PrecioSKU&lt;BR /&gt;*if(fe_ul_pa - vence_en &amp;gt;= 45, 10&lt;BR /&gt;,if(fe_ul_pa - vence_en &amp;gt;= 41, .5&lt;BR /&gt;,if(fe_ul_pa - vence_en &amp;gt;= 36, .1&lt;BR /&gt;,if(fe_ul_pa - vence_en &amp;gt;= 0, .2))))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jan 2010 18:16:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-if-else-into-set-analysis/m-p/147608#M505363</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-01-26T18:16:57Z</dc:date>
    </item>
    <item>
      <title>Nested if-else into set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-if-else-into-set-analysis/m-p/147609#M505364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks John this solution works for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;May I apply a sum to this result in order to get summary?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jan 2010 22:31:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-if-else-into-set-analysis/m-p/147609#M505364</guid>
      <dc:creator />
      <dc:date>2010-01-26T22:31:42Z</dc:date>
    </item>
    <item>
      <title>Nested if-else into set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-if-else-into-set-analysis/m-p/147610#M505365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should be able to. Just sum(that expression).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jan 2010 23:01:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-if-else-into-set-analysis/m-p/147610#M505365</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-01-26T23:01:48Z</dc:date>
    </item>
  </channel>
</rss>

