<?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: last available value whith condition in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/last-available-value-whith-condition/m-p/615148#M226943</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You'll have to create a numeric value of the Year Month field. Then you can use the firstsortedvalue function to get the result you need. See attached qvw.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Mar 2014 16:01:21 GMT</pubDate>
    <dc:creator>Gysbert_Wassenaar</dc:creator>
    <dc:date>2014-03-07T16:01:21Z</dc:date>
    <item>
      <title>last available value whith condition</title>
      <link>https://community.qlik.com/t5/QlikView/last-available-value-whith-condition/m-p/615145#M226940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the following table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 363px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" width="70"&gt;Year Month&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="180"&gt;FLAG1&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="113"&gt;VALUE1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;Mar 2012&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;48205&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;Apr 2012&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;48205&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;May 2012&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;48205&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;Jun 2012&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;48205&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;July 2012&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;48205&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;Aug 2012&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;48205&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;Sep 2012&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;49192&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;Oct 2012&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;49192&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;Nov 2012&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;49192&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;Dec 2012&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;49192&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;Jan 2013&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;49192&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;Feb 2013&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;49192&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;Mar 2013&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;49192&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;Apr 2013&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;49192&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;May 2013&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need, in a text box, the last available value of VALUE1 before or when FLAG=1.&lt;/P&gt;&lt;P&gt;in this case I should have 49192 (Apr 2013).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Yacine&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2014 15:52:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/last-available-value-whith-condition/m-p/615145#M226940</guid>
      <dc:creator />
      <dc:date>2014-03-07T15:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: last available value whith condition</title>
      <link>https://community.qlik.com/t5/QlikView/last-available-value-whith-condition/m-p/615146#M226941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;=Max({$ &amp;lt;FLAG1={0}&amp;gt;}VALUE1)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2014 15:56:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/last-available-value-whith-condition/m-p/615146#M226941</guid>
      <dc:creator>alexandros17</dc:creator>
      <dc:date>2014-03-07T15:56:38Z</dc:date>
    </item>
    <item>
      <title>Re: last available value whith condition</title>
      <link>https://community.qlik.com/t5/QlikView/last-available-value-whith-condition/m-p/615147#M226942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;var=peek( 'Value1', -2 )&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp; use in Script after above lpading table &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then take =$(var) where ever you want&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2014 15:57:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/last-available-value-whith-condition/m-p/615147#M226942</guid>
      <dc:creator>SunilChauhan</dc:creator>
      <dc:date>2014-03-07T15:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: last available value whith condition</title>
      <link>https://community.qlik.com/t5/QlikView/last-available-value-whith-condition/m-p/615148#M226943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You'll have to create a numeric value of the Year Month field. Then you can use the firstsortedvalue function to get the result you need. See attached qvw.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2014 16:01:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/last-available-value-whith-condition/m-p/615148#M226943</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2014-03-07T16:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: last available value whith condition</title>
      <link>https://community.qlik.com/t5/QlikView/last-available-value-whith-condition/m-p/615149#M226944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this is not works good because when I dont have FLAG=1 in all the list, then I should have 0&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2014 16:42:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/last-available-value-whith-condition/m-p/615149#M226944</guid>
      <dc:creator />
      <dc:date>2014-03-07T16:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: Re: last available value whith condition</title>
      <link>https://community.qlik.com/t5/QlikView/last-available-value-whith-condition/m-p/615150#M226945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A more appropriate response would be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Thanks Gysbert, your reply is helpful (and I mark it so) and it works.&amp;nbsp; I have an additional request - when I don't have FLAG=1 in all the list, then I should have 0.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Regards,&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Yacine&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And Gysbert would tell you to modify the text box a little, for example&lt;BR /&gt;=if(min(FLAG1)=1, 0,&lt;BR /&gt;FirstSortedValue({&amp;lt;FLAG1={0}&amp;gt;}VALUE1,-[Year Month]))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2014 16:59:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/last-available-value-whith-condition/m-p/615150#M226945</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-03-07T16:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: last available value whith condition</title>
      <link>https://community.qlik.com/t5/QlikView/last-available-value-whith-condition/m-p/615151#M226946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank you for your reply&lt;/P&gt;&lt;P&gt;sorry I didn't explain what I want clearly.&lt;/P&gt;&lt;P&gt;this is not working in my case because the lists exists for all the orders. I show you in my first post only the data of one orger.&lt;/P&gt;&lt;P&gt;that means, some orders have FLAG=1, some other don't have it. what I need is :&lt;/P&gt;&lt;P&gt;- if an order dont have FLAG=1 then 0&lt;/P&gt;&lt;P&gt;- else, get the last VALUE1 (on last month) before or equal to FLAG1=1.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2014 17:48:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/last-available-value-whith-condition/m-p/615151#M226946</guid>
      <dc:creator />
      <dc:date>2014-03-07T17:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: last available value whith condition</title>
      <link>https://community.qlik.com/t5/QlikView/last-available-value-whith-condition/m-p/615152#M226947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yacine,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First, no offence meant &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;.&lt;/P&gt;&lt;P&gt;Second, it is less clear now &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/confused.png" /&gt;.&amp;nbsp; From you latest explanation, the result should be per order (which is not in the opening post).&amp;nbsp; On the other hand, if it is a text box, there should be one result.&amp;nbsp; I can think of&amp;nbsp; a chart where order is a dimension, so each order can have it's own result.&lt;/P&gt;&lt;P&gt;It would be easier to help if you could upload your application if it exists, otherwise a dataset (in Excel file, for example).&amp;nbsp; The chances are that the expression from my previous reply should work in a chart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;P&gt;PS: I have to go offline now for a while.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2014 18:10:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/last-available-value-whith-condition/m-p/615152#M226947</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-03-07T18:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: last available value whith condition</title>
      <link>https://community.qlik.com/t5/QlikView/last-available-value-whith-condition/m-p/615153#M226948</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;it should be a text box which contain the sum of VALUE1&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2014 18:23:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/last-available-value-whith-condition/m-p/615153#M226948</guid>
      <dc:creator />
      <dc:date>2014-03-07T18:23:48Z</dc:date>
    </item>
    <item>
      <title>Re: last available value whith condition</title>
      <link>https://community.qlik.com/t5/QlikView/last-available-value-whith-condition/m-p/615154#M226949</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In this case you can use sum of the expression (I fixed it a little) aggregated by order.&amp;nbsp; If there is a field orderid unique per order, it is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=&lt;STRONG&gt;sum(aggr(&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(sum(FLAG1)=0, 0, FirstSortedValue({&amp;lt;FLAG1={0}&amp;gt;}VALUE1,-[Year Month]))&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,orderid))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, for each order, the value is 0 if there is not a single FLAG1=1, and VALUE1 for the last FLAG1=0.&amp;nbsp; That is, from the "before or equal", we use "before" - VALUE1 for last 0 per order.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2014 19:20:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/last-available-value-whith-condition/m-p/615154#M226949</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-03-07T19:20:06Z</dc:date>
    </item>
  </channel>
</rss>

