<?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: In expression, when there are no data for selected year, pic data from year-1. in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/In-expression-when-there-are-no-data-for-selected-year-pic-data/m-p/440148#M1160180</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello &lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" href="https://community.qlik.com/people/hofstedt" id="jive-6954912166381149745860" style="background-color: #ffffff; font-size: 12px; color: #007fc0; text-decoration: initial; font-weight: bold; font-family: Arial; text-align: center;"&gt;hofstedt&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I think you are in a little mess with dates and types:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If you want to work with "Number of Year", this is a number (2011, 2012, 2013...) and only a number. You can substract 1 and then you have the year before.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If you want to work with dates, you need a full date (year, month and day). In this case you can use MakeDate function to build a valid date, for example MakeDate(YEARFIELD) or MakeDate(Num(YEARFIELD)), month and day defaults to 1 in this example. In this case you will have a Date type, and you can use the date functions, like AddMonths(), etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 21 Jan 2013 16:51:33 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-01-21T16:51:33Z</dc:date>
    <item>
      <title>In expression, when there are no data for selected year, pic data from year-1.</title>
      <link>https://community.qlik.com/t5/QlikView/In-expression-when-there-are-no-data-for-selected-year-pic-data/m-p/440146#M1160178</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I have a dimension with numbers, 2010,2011, 2012 that works as year field. The problem is that the data are read by qv as text (in a tablebox qv puts the numbers to the left) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use it in a expression, but when there are no data for 2012 I would like to set it to use the data for previous year. Therefor I convert it to date format In the script by &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&lt;SPAN style=": ; color: #0000ff; font-size: 8pt;"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Date&lt;/P&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Date#&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(YEARFIELD&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, 'YYYY'), 'YYYY')&amp;nbsp; as NewYearField&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; But then in the application, when I put NewYearField - 1 (and select 2012) I only get 40908. How can I fix this? Or should I solve the basic problem with lack of data on some other way? The basic problem is that: When there are no data for selected year, do the caluculation with the data from prevoius year or in worst case the year before that. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jan 2013 15:46:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/In-expression-when-there-are-no-data-for-selected-year-pic-data/m-p/440146#M1160178</guid>
      <dc:creator />
      <dc:date>2013-01-21T15:46:53Z</dc:date>
    </item>
    <item>
      <title>Re: In expression, when there are no data for selected year, pic data from year-1.</title>
      <link>https://community.qlik.com/t5/QlikView/In-expression-when-there-are-no-data-for-selected-year-pic-data/m-p/440147#M1160179</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;The problem is that NewYearField is a date so for 2012 the value in NewYearField is 01/01/2012, when you use&amp;nbsp; NewYearField - 1 , the result value '40908' is the number equivalent to the date 31/12/2011. I can think on two solutions for this problem:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) You can use: Year( NewYearField ) -1 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) In your script you can convert your YEARFIELD as number using: &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; num#( YEARFIELD ) as NewYearField&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and you can use: NewYearField - 1 to get the previous year&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;Regards!&lt;SPAN style="color: #737373; font-size: 11px; background-color: #ffffff; font-family: Arial;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jan 2013 16:46:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/In-expression-when-there-are-no-data-for-selected-year-pic-data/m-p/440147#M1160179</guid>
      <dc:creator />
      <dc:date>2013-01-21T16:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: In expression, when there are no data for selected year, pic data from year-1.</title>
      <link>https://community.qlik.com/t5/QlikView/In-expression-when-there-are-no-data-for-selected-year-pic-data/m-p/440148#M1160180</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello &lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" href="https://community.qlik.com/people/hofstedt" id="jive-6954912166381149745860" style="background-color: #ffffff; font-size: 12px; color: #007fc0; text-decoration: initial; font-weight: bold; font-family: Arial; text-align: center;"&gt;hofstedt&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I think you are in a little mess with dates and types:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If you want to work with "Number of Year", this is a number (2011, 2012, 2013...) and only a number. You can substract 1 and then you have the year before.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If you want to work with dates, you need a full date (year, month and day). In this case you can use MakeDate function to build a valid date, for example MakeDate(YEARFIELD) or MakeDate(Num(YEARFIELD)), month and day defaults to 1 in this example. In this case you will have a Date type, and you can use the date functions, like AddMonths(), etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jan 2013 16:51:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/In-expression-when-there-are-no-data-for-selected-year-pic-data/m-p/440148#M1160180</guid>
      <dc:creator />
      <dc:date>2013-01-21T16:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: In expression, when there are no data for selected year, pic data from year-1.</title>
      <link>https://community.qlik.com/t5/QlikView/In-expression-when-there-are-no-data-for-selected-year-pic-data/m-p/440149#M1160181</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, I will try the makedate. It opens for the use of a calendar...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jan 2013 19:19:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/In-expression-when-there-are-no-data-for-selected-year-pic-data/m-p/440149#M1160181</guid>
      <dc:creator />
      <dc:date>2013-01-21T19:19:36Z</dc:date>
    </item>
  </channel>
</rss>

