<?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: Substitute to nested ifs in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Substitute-to-nested-ifs/m-p/722905#M259461</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is a really complicated statement. Depending on records, the performance must be really bad. I would suggest that you create flags in the data model (reload script) and use those in your set analysis statements.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Aug 2014 14:07:42 GMT</pubDate>
    <dc:creator>giakoum</dc:creator>
    <dc:date>2014-08-21T14:07:42Z</dc:date>
    <item>
      <title>Substitute to nested ifs</title>
      <link>https://community.qlik.com/t5/QlikView/Substitute-to-nested-ifs/m-p/722904#M259460</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&gt;&lt;/P&gt;&lt;P&gt;I've been trying to figure this one out for a while and am having no luck. I wish to get rid of my nested if statements in my variables as I have a lot of these&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(IsNull(sum({&amp;lt;Year,Month,Day, F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} SalesLossValue)/sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} OrderCase))&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;(sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} SalesLossValue)/sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} OrderCase)*100) &amp;lt;=3,50,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if((sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} SalesLossValue)/sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} OrderCase)*100) &amp;gt;3 &lt;/P&gt;&lt;P&gt;and (sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} SalesLossValue)/sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} OrderCase)*100) &amp;lt;=4,45,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if((sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} SalesLossValue)/sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} OrderCase)*100) &amp;gt;4 &lt;/P&gt;&lt;P&gt;and (sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} SalesLossValue)/sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} OrderCase)*100) &amp;lt;=6,40,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if((sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} SalesLossValue)/sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} OrderCase)*100) &amp;gt;6 &lt;/P&gt;&lt;P&gt;and (sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} SalesLossValue)/sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} OrderCase)*100) &amp;lt;=8,35,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if((sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} SalesLossValue)/sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} OrderCase)*100) &amp;gt;8 &lt;/P&gt;&lt;P&gt;and (sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} SalesLossValue)/sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} OrderCase)*100) &amp;lt;=10,30,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if((sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} SalesLossValue)/sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} OrderCase)*100) &amp;gt;10 &lt;/P&gt;&lt;P&gt;and (sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} SalesLossValue)/sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} OrderCase)*100) &amp;lt;=11,29,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if((sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} SalesLossValue)/sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} OrderCase)*100) &amp;gt;11 &lt;/P&gt;&lt;P&gt;and (sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} SalesLossValue)/sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} OrderCase)*100) &amp;lt;=13,28,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if((sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} SalesLossValue)/sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} OrderCase)*100) &amp;gt;13 &lt;/P&gt;&lt;P&gt;and (sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} SalesLossValue)/sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} OrderCase)*100) &amp;lt;=16,27,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if((sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} SalesLossValue)/sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} OrderCase)*100) &amp;gt;16 &lt;/P&gt;&lt;P&gt;and (sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} SalesLossValue)/sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} OrderCase)*100) &amp;lt;=20,26,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If((sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} SalesLossValue)/sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} OrderCase)*100) &amp;gt;20,25&lt;/P&gt;&lt;P&gt;))))))))))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Aug 2014 14:00:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Substitute-to-nested-ifs/m-p/722904#M259460</guid>
      <dc:creator />
      <dc:date>2014-08-21T14:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: Substitute to nested ifs</title>
      <link>https://community.qlik.com/t5/QlikView/Substitute-to-nested-ifs/m-p/722905#M259461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is a really complicated statement. Depending on records, the performance must be really bad. I would suggest that you create flags in the data model (reload script) and use those in your set analysis statements.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Aug 2014 14:07:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Substitute-to-nested-ifs/m-p/722905#M259461</guid>
      <dc:creator>giakoum</dc:creator>
      <dc:date>2014-08-21T14:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: Substitute to nested ifs</title>
      <link>https://community.qlik.com/t5/QlikView/Substitute-to-nested-ifs/m-p/722906#M259462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suggest you to use a pick(match() approach to simplify your expression. However pick(match()) works only with equal values - a greater or less didn't work. Therefore you need a logic to modify your condition in certain intervals or simply as listing. For your case a round-function like ceil() or floor() and a return-listing should be enough:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pick(match(&lt;/P&gt;&lt;P&gt;ceil(&lt;/P&gt;&lt;P&gt;sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} SalesLossValue)/sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} OrderCase)*100)),&lt;/P&gt;&lt;P&gt;1,2,3,4,5,6,7,8,9,10 .......),&lt;/P&gt;&lt;P&gt;50,50,50,45,45 .....)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With some adjustment this will work - I use it quite often.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Aug 2014 14:55:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Substitute-to-nested-ifs/m-p/722906#M259462</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2014-08-21T14:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: Substitute to nested ifs</title>
      <link>https://community.qlik.com/t5/QlikView/Substitute-to-nested-ifs/m-p/722907#M259463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This seems to be a big expression and not good for Performance. As a step towards performance tuning. You should aggregate most of stuff in Script.-Ram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Aug 2014 15:40:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Substitute-to-nested-ifs/m-p/722907#M259463</guid>
      <dc:creator />
      <dc:date>2014-08-21T15:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: Substitute to nested ifs</title>
      <link>https://community.qlik.com/t5/QlikView/Substitute-to-nested-ifs/m-p/722908#M259464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are using in a straight table then try like this, create two expressions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Exp1:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;=(sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} SalesLossValue)/sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} OrderCase)*100)&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;Exp2:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; (sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} SalesLossValue)/sum({&amp;lt;Year,Month,Day,F_Class_Code = {'1'},DATE={'&amp;gt;=$(vLast11Month)&amp;lt;=$(vEndDate)'}&amp;gt;} OrderCase)*100)&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;Now in your actual expression try like this&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;If([Exp1] &amp;gt; 3 AND [Exp2] &amp;lt;5, 45,&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;'&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;and in presentation tab hide Exp1 and Exp2, by this way you can reuse and reduce the size of the expression.&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;Hope this helps you.&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;Regards,&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Aug 2014 16:05:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Substitute-to-nested-ifs/m-p/722908#M259464</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2014-08-21T16:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: Substitute to nested ifs</title>
      <link>https://community.qlik.com/t5/QlikView/Substitute-to-nested-ifs/m-p/722909#M259465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am going to try these suggestions and let you guys know. Thanks a lot!&lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Aug 2014 04:26:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Substitute-to-nested-ifs/m-p/722909#M259465</guid>
      <dc:creator />
      <dc:date>2014-08-22T04:26:49Z</dc:date>
    </item>
  </channel>
</rss>

