<?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 If statement returning null value in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/If-statement-returning-null-value/m-p/310381#M114586</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;Hi guys,&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt; &lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;I'm having a bit of a problem with an if statement. What happens is a list box containing a list of month ends is selected. A table then displays values for this month end and the previous 12 as well in different columns. This expression is used to get the month ends for the previous months.&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt; &lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;SPAN style="color: #808080; font-size: 8pt;"&gt;The if statement checks if the amount of months to look back is greater than the amount of months passed that year and if so, minuses a year &lt;/SPAN&gt;&lt;SPAN style="color: #808080; font-size: 8pt;"&gt; &lt;/SPAN&gt;and sets the month to the correct month in the previous year. The problem I am encountering is that if the date is more than 1 month into the previous year it retuns a null value. If the first section that simply sets the month and doesn't change the year is commented out it works fine. &lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt; &lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;It seems like because this part of the statement would return a null value if run on a date where not enough months were left in the year it is stopping the expression from working, even though in those instances the else section should be running.&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt; &lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;EM&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;=If(([Month]-7)&amp;gt;1,&lt;/P&gt;&lt;P&gt;MonthEnd(Sum({$&amp;lt;[Display Year]={$(=[Year])}, [Display Month]={$(=[Month]-7)}, [Display Day] = {1}&amp;gt;}[Invoice Date]))&lt;/P&gt;&lt;P&gt;,&lt;/P&gt;&lt;P&gt;MonthEnd(Sum({$&amp;lt;[Display Year]={$(=[Year]-1)}, [Display Month]={$(=[Month]+5)}, [Display Day] = {1}&amp;gt;}[Invoice Datel]))&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Nov 2011 15:27:18 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-11-10T15:27:18Z</dc:date>
    <item>
      <title>If statement returning null value</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-returning-null-value/m-p/310381#M114586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;Hi guys,&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt; &lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;I'm having a bit of a problem with an if statement. What happens is a list box containing a list of month ends is selected. A table then displays values for this month end and the previous 12 as well in different columns. This expression is used to get the month ends for the previous months.&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt; &lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;SPAN style="color: #808080; font-size: 8pt;"&gt;The if statement checks if the amount of months to look back is greater than the amount of months passed that year and if so, minuses a year &lt;/SPAN&gt;&lt;SPAN style="color: #808080; font-size: 8pt;"&gt; &lt;/SPAN&gt;and sets the month to the correct month in the previous year. The problem I am encountering is that if the date is more than 1 month into the previous year it retuns a null value. If the first section that simply sets the month and doesn't change the year is commented out it works fine. &lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt; &lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;It seems like because this part of the statement would return a null value if run on a date where not enough months were left in the year it is stopping the expression from working, even though in those instances the else section should be running.&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt; &lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;EM&gt;&lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;=If(([Month]-7)&amp;gt;1,&lt;/P&gt;&lt;P&gt;MonthEnd(Sum({$&amp;lt;[Display Year]={$(=[Year])}, [Display Month]={$(=[Month]-7)}, [Display Day] = {1}&amp;gt;}[Invoice Date]))&lt;/P&gt;&lt;P&gt;,&lt;/P&gt;&lt;P&gt;MonthEnd(Sum({$&amp;lt;[Display Year]={$(=[Year]-1)}, [Display Month]={$(=[Month]+5)}, [Display Day] = {1}&amp;gt;}[Invoice Datel]))&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Nov 2011 15:27:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-returning-null-value/m-p/310381#M114586</guid>
      <dc:creator />
      <dc:date>2011-11-10T15:27:18Z</dc:date>
    </item>
  </channel>
</rss>

