<?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: Better alternative to nested if statement in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Better-alternative-to-nested-if-statement/m-p/685222#M248342</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, a better way would be to take a lot of the logic to the script and create flags that could then be referenced in the UI expressions. If you're determined to do it purely in the UI and just want to avoid manually typing a huge expressions, see attached.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vlad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 Sep 2014 19:48:01 GMT</pubDate>
    <dc:creator>vgutkovsky</dc:creator>
    <dc:date>2014-09-24T19:48:01Z</dc:date>
    <item>
      <title>Better alternative to nested if statement</title>
      <link>https://community.qlik.com/t5/QlikView/Better-alternative-to-nested-if-statement/m-p/685221#M248341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;I have a file that uses nested if statement. At the moment this is not a problem since I'm working with a small sample, but for the final version I'll need about 53 statements.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I'm using this expression in a straight table to calculate wks sup. For every week, I need to compare the current inventory to the aggregate sum of forecasts for all the weeks before.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;I'm trying to find a more efficient way.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;This is the code in the smaller sample:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P&gt;if(sum([inventory - current])=0,0,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(sum([inventory - current])&amp;gt;sum(forecast),'&amp;gt;year',&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(sum([inventory - current])&amp;lt;sum(if([calc week]&amp;lt;=1,forecast)),0,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(sum([inventory - current])&amp;lt;sum(if([calc week]&amp;lt;=2,forecast)),1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;,2))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;))&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Is there a way to rewrite this without the nested if statemets?&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Sep 2014 16:23:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Better-alternative-to-nested-if-statement/m-p/685221#M248341</guid>
      <dc:creator />
      <dc:date>2014-09-24T16:23:23Z</dc:date>
    </item>
    <item>
      <title>Re: Better alternative to nested if statement</title>
      <link>https://community.qlik.com/t5/QlikView/Better-alternative-to-nested-if-statement/m-p/685222#M248342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, a better way would be to take a lot of the logic to the script and create flags that could then be referenced in the UI expressions. If you're determined to do it purely in the UI and just want to avoid manually typing a huge expressions, see attached.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vlad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Sep 2014 19:48:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Better-alternative-to-nested-if-statement/m-p/685222#M248342</guid>
      <dc:creator>vgutkovsky</dc:creator>
      <dc:date>2014-09-24T19:48:01Z</dc:date>
    </item>
  </channel>
</rss>

