<?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 Returning values within a set range in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Returning-values-within-a-set-range/m-p/371903#M1176197</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; ooo! Have you got any examples of this please, im fairly new to set analysis &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 May 2012 14:04:02 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-05-29T14:04:02Z</dc:date>
    <item>
      <title>Returning values within a set range</title>
      <link>https://community.qlik.com/t5/QlikView/Returning-values-within-a-set-range/m-p/371899#M1176193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good afternoon, I need to do some averages on some data but I only want to use the most recent date and a date thats as close to as a year ago as possible. i.e. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;28.05.2012&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;24.02.2012&lt;/P&gt;&lt;P&gt;10.10.2011&lt;/P&gt;&lt;P&gt;08.07.2012&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;29.05.2012&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;26.05.2012&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Above is a range of dates using the most recent date and a date up to a year ago(as close as possible) ignoring all the data inbetween.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I go about this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 May 2012 15:14:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Returning-values-within-a-set-range/m-p/371899#M1176193</guid>
      <dc:creator />
      <dc:date>2012-05-28T15:14:22Z</dc:date>
    </item>
    <item>
      <title>Returning values within a set range</title>
      <link>https://community.qlik.com/t5/QlikView/Returning-values-within-a-set-range/m-p/371900#M1176194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi, in the scrip you can make a table to load top 10 o 20 dates, the data source table must be ordered by date.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 May 2012 15:37:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Returning-values-within-a-set-range/m-p/371900#M1176194</guid>
      <dc:creator />
      <dc:date>2012-05-28T15:37:01Z</dc:date>
    </item>
    <item>
      <title>Returning values within a set range</title>
      <link>https://community.qlik.com/t5/QlikView/Returning-values-within-a-set-range/m-p/371901#M1176195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Ermm that really didnt help me at all. Im needing help on scripting, not on ordering the data that I already have, I am needing to get the 1st and last date value within a range of a year from today.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2012 08:00:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Returning-values-within-a-set-range/m-p/371901#M1176195</guid>
      <dc:creator />
      <dc:date>2012-05-29T08:00:02Z</dc:date>
    </item>
    <item>
      <title>Returning values within a set range</title>
      <link>https://community.qlik.com/t5/QlikView/Returning-values-within-a-set-range/m-p/371902#M1176196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Paul,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could add a flag field to your load script setting dates within past year to 1 and others to 0, then specify this flag in a set analysis statement for your averages. That's how I normally do running YTD calculations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;flipside&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2012 13:40:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Returning-values-within-a-set-range/m-p/371902#M1176196</guid>
      <dc:creator>flipside</dc:creator>
      <dc:date>2012-05-29T13:40:25Z</dc:date>
    </item>
    <item>
      <title>Returning values within a set range</title>
      <link>https://community.qlik.com/t5/QlikView/Returning-values-within-a-set-range/m-p/371903#M1176197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; ooo! Have you got any examples of this please, im fairly new to set analysis &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2012 14:04:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Returning-values-within-a-set-range/m-p/371903#M1176197</guid>
      <dc:creator />
      <dc:date>2012-05-29T14:04:02Z</dc:date>
    </item>
    <item>
      <title>Returning values within a set range</title>
      <link>https://community.qlik.com/t5/QlikView/Returning-values-within-a-set-range/m-p/371904#M1176198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; at the moment im using &lt;SPAN style="font-family: Courier New; color: #0000ff; font-size: 8pt;"&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt; font-family: Courier New;"&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt; font-family: Courier New;"&gt;&lt;SPAN style=": ; color: #0000ff; font-size: 1; font-family: 'Courier New';"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt; &lt;P&gt;&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp; &lt;A&gt;&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;SPAN style="font-size: 8pt; font-family: Courier New;"&gt;if(max(Meter_Reading_Date)&amp;lt;=today(),Meter_Reading)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;(as an expression)&lt;/P&gt;&lt;P align="left"&gt;&lt;SPAN style="font-family: Courier New; color: #0000ff; font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt; font-family: Courier New;"&gt;its giving me randomly correct and incorrect and even sometimes blank data&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-GB"&gt;&lt;/SPAN&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2012 14:06:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Returning-values-within-a-set-range/m-p/371904#M1176198</guid>
      <dc:creator />
      <dc:date>2012-05-29T14:06:47Z</dc:date>
    </item>
    <item>
      <title>Returning values within a set range</title>
      <link>https://community.qlik.com/t5/QlikView/Returning-values-within-a-set-range/m-p/371905#M1176199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've gotten FirstSortedValue(Places_Before_Decimal_Point_In_Meter_Reading,-Meter_Reading_Date) to work out the latest meter read date. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I go about getting a meter reading thats the furthest back inside a year? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2012 15:27:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Returning-values-within-a-set-range/m-p/371905#M1176199</guid>
      <dc:creator />
      <dc:date>2012-05-29T15:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: Returning values within a set range</title>
      <link>https://community.qlik.com/t5/QlikView/Returning-values-within-a-set-range/m-p/371906#M1176200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is something that should help.&amp;nbsp; I wasn't sure if you wanted the oldest date within the year, or the date nearest to 1 year ago, so have added flags in the load script for both options.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 May 2012 10:09:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Returning-values-within-a-set-range/m-p/371906#M1176200</guid>
      <dc:creator>flipside</dc:creator>
      <dc:date>2012-05-30T10:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: Returning values within a set range</title>
      <link>https://community.qlik.com/t5/QlikView/Returning-values-within-a-set-range/m-p/371907#M1176201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; This looks very good, a little complex for what im trying to achieve. I currently use this to obtain the most recent date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FirstSortedValue(Places_Before_Decimal_Point_In_Meter_Reading,-Meter_Reading_Date)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use this to get the oldest date:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FirstSortedValue(Places_Before_Decimal_Point_In_Meter_Reading,Meter_Reading_Date).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;im needing an adaptation of this to get the oldest value up to 425 days of age. Do you now how to achieve this ? &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 May 2012 13:53:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Returning-values-within-a-set-range/m-p/371907#M1176201</guid>
      <dc:creator />
      <dc:date>2012-05-30T13:53:15Z</dc:date>
    </item>
    <item>
      <title>Re: Returning values within a set range</title>
      <link>https://community.qlik.com/t5/QlikView/Returning-values-within-a-set-range/m-p/371908#M1176202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would probably use variables to make this easier.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Set up a variable to hold the value of the comparison date (Latest date minus 425)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vDateCompare&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Definition: =max(Meter_Reading_Date)-425&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Use this expression&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =date(alt(max({&amp;lt;Meter_Reading_Date={'&amp;lt;$(vDateCompare)'}&amp;gt;} Meter_Reading_Date),min(Meter_Reading_Date)),'DD/MM/YYYY')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This can be broken down into 3 parts as follows ...&lt;/P&gt;&lt;P&gt;i) Return the latest date where the date is less than the variable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; =max({&amp;lt;Meter_Reading_Date={'&amp;lt;$(vDateCompare)'}&amp;gt;} Meter_Reading_Date)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ii) If there are no dates, you need to return the oldest date available so wrap an alt statement around it&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; =&lt;STRONG&gt;alt(&lt;/STRONG&gt;max({&amp;lt;Meter_Reading_Date={'&amp;lt;$(vDateCompare)'}&amp;gt;} Meter_Reading_Date)&lt;STRONG&gt;,min(Meter_Reading_Date))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;iii) Finally, if this is to go into a text box, format the expression to a date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; =&lt;STRONG&gt;date(&lt;/STRONG&gt;alt(max({&amp;lt;Meter_Reading_Date={'&amp;lt;$(vDateCompare)'}&amp;gt;} Meter_Reading_Date),min(Meter_Reading_Date))&lt;STRONG&gt;,'DD/MM/YYYY')&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;flipside &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 May 2012 22:43:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Returning-values-within-a-set-range/m-p/371908#M1176202</guid>
      <dc:creator>flipside</dc:creator>
      <dc:date>2012-05-30T22:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: Returning values within a set range</title>
      <link>https://community.qlik.com/t5/QlikView/Returning-values-within-a-set-range/m-p/371909#M1176203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Thanks for your help. This has been a good learning experience, Luckily I got to the result I needed by correctly applying First sorted Value.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2012 12:09:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Returning-values-within-a-set-range/m-p/371909#M1176203</guid>
      <dc:creator />
      <dc:date>2012-05-31T12:09:42Z</dc:date>
    </item>
  </channel>
</rss>

