<?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 statement in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Nested-if-statement/m-p/174391#M43240</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent, thanks Miguel.. Knew there was an easier way of doing it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Mar 2010 14:27:31 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-03-10T14:27:31Z</dc:date>
    <item>
      <title>Nested if statement</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-if-statement/m-p/174387#M43236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Calendar:&lt;/P&gt;&lt;P&gt;LOAD hash128(TransactionDATE) AS TransactionDATEKey&lt;/P&gt;&lt;P&gt;,Date(Monthstart(DATE#(TransactionDATE,'YYYYMM')), 'MM') as MonthNumber&lt;/P&gt;&lt;P&gt;,Year(DATE#(TransactionDATE,'YYYYMM')) as Year&lt;/P&gt;&lt;P&gt;,DATE#(TransactionDATE,'YYYYMM') as YearMonth&lt;/P&gt;&lt;P&gt;,Month(DATE#(TransactionDATE,'YYYYMM')) as Month&lt;/P&gt;&lt;P&gt;,Days&lt;/P&gt;&lt;P&gt;,IF(Year(DATE#(TransactionDATE,'YYYYMM')) = '2008', 1, 0) as PPYFlag&lt;/P&gt;&lt;P&gt;,IF(Year(DATE#(TransactionDATE,'YYYYMM')) = '2009', 1, 0) as PYFlag&lt;/P&gt;&lt;P&gt;,IF(Year(DATE#(TransactionDATE,'YYYYMM')) = '2010', 1, 0) as CYFlag&lt;/P&gt;&lt;P&gt;,'Q' &amp;amp; Ceil(Month(DATE#(TransactionDATE,'YYYYMM'))/3) as Quarter&lt;/P&gt;&lt;P&gt;,IF((num#(Date(Monthstart(DATE#(TransactionDATE,'YYYYMM')), 'MM'),'#') &amp;gt; '0' and num#(Date(Monthstart(DATE#(TransactionDATE,'YYYYMM')), 'MM'),'#') &amp;lt;= '12')&lt;/P&gt;&lt;P&gt;,Month(DATE#(TransactionDATE,'YYYYMM')), '') as CYYearMonth&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;,if(TransactionDATE = '200702', '28',&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt; if(TransactionDATE = '200802', '29',&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt; &lt;STRONG&gt;if(TransactionDATE = '200902', '28',&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt; if(TransactionDATE = '201002', '28',&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if(right(TransactionDATE,2) = '01', '31',&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if(right(TransactionDATE,2) = '03', '31',&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if(right(TransactionDATE,2) = '05', '31',&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if(right(TransactionDATE,2) = '07', '31',&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if(right(TransactionDATE,2) = '08', '31',&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if(right(TransactionDATE,2) = '10', '31',&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if(right(TransactionDATE,2) = '12', '31',&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if(right(TransactionDATE,2) = '04', '30',&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if(right(TransactionDATE,2) = '06', '30',&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if(right(TransactionDATE,2) = '09', '30',&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if(right(TransactionDATE,2) = '11', '30', right(TransactionDATE,2))))))))))))))))) as Days&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;from $(zqvdpath) TransactionsQVD.qvd (qvd);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My nested if statement is giving errors... It is saying:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="error loading image" class="jive-image error-loading-image" src="https://community.qlik.com/legacyfs/online/-1221_sourceID:1221" /&gt;&lt;/P&gt;&lt;P&gt;and various other errors.. i have changed it around so much that i do not know where i started &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Please could someone help me out or point out what i'm doing wrong.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Mar 2010 12:40:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-if-statement/m-p/174387#M43236</guid>
      <dc:creator />
      <dc:date>2010-03-10T12:40:06Z</dc:date>
    </item>
    <item>
      <title>Nested if statement</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-if-statement/m-p/174388#M43237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Richard,&lt;/P&gt;&lt;P&gt;Rather than checking that error and check one by one every parentheses pair in your nested if, why don't you use a map? Syntax would be something like&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;DaysMap:MAPPING LOAD * INLINE [ TransactionDate, Day 200902, 28 201002, 28 01, 31]; Calendar:LOAD ... ApplyMap('DaysMap', right(TransactionDATE, 2)) AS Days&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;It's easier to debug and clearer to work with.&lt;/P&gt;&lt;P&gt;It seems that you are trying to get correct number of total days in a month, so, another suggestion is&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Day(MonthEnd(TransactionDATE)) AS Days&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Mar 2010 13:15:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-if-statement/m-p/174388#M43237</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2010-03-10T13:15:32Z</dc:date>
    </item>
    <item>
      <title>Nested if statement</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-if-statement/m-p/174389#M43238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is one too mach closing parenthesis. Last one must be eraised.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Mar 2010 13:54:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-if-statement/m-p/174389#M43238</guid>
      <dc:creator />
      <dc:date>2010-03-10T13:54:03Z</dc:date>
    </item>
    <item>
      <title>Nested if statement</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-if-statement/m-p/174390#M43239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if(TransactionDATE = '200702', '28', if(TransactionDATE = '200802', '29', if(TransactionDATE = '200902', '28', if(TransactionDATE = '201002', '28', if(right(TransactionDATE,2) = '01', '31', if(right(TransactionDATE,2) = '03', '31', if(right(TransactionDATE,2) = '05', '31', if(right(TransactionDATE,2) = '07', '31', if(right(TransactionDATE,2) = '08', '31', if(right(TransactionDATE,2) = '10', '31', if(right(TransactionDATE,2) = '12', '31', if(right(TransactionDATE,2) = '04', '30', if(right(TransactionDATE,2) = '06', '30', if(right(TransactionDATE,2) = '09', '30', if(right(TransactionDATE,2) = '11', '30', right(TransactionDATE,2)))))))))))))))) as Days&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Mar 2010 13:55:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-if-statement/m-p/174390#M43239</guid>
      <dc:creator />
      <dc:date>2010-03-10T13:55:51Z</dc:date>
    </item>
    <item>
      <title>Nested if statement</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-if-statement/m-p/174391#M43240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent, thanks Miguel.. Knew there was an easier way of doing it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Mar 2010 14:27:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-if-statement/m-p/174391#M43240</guid>
      <dc:creator />
      <dc:date>2010-03-10T14:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: Nested if statement</title>
      <link>https://community.qlik.com/t5/QlikView/Nested-if-statement/m-p/174392#M43241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;generally speaking it would be better to avoid a nested if scenario in your case (as already suggested by other comments).&lt;/P&gt;&lt;P&gt;But if you are still struggling with the nested ifs, maybe you want to have a look at&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.qlikblog.at/464/tool-creating-nested-ifstatements/"&gt;http://www.qlikblog.at/464/tool-creating-nested-ifstatements/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Regards, Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Apr 2011 15:32:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Nested-if-statement/m-p/174392#M43241</guid>
      <dc:creator>Stefan_Walther</dc:creator>
      <dc:date>2011-04-29T15:32:25Z</dc:date>
    </item>
  </channel>
</rss>

