<?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: Return first data for last negative value period in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Return-first-data-for-last-negative-value-period/m-p/664261#M668916</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Used some sorting in the load script to pick up the first negative value in the latest continous block of negative values:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG.png" class="jive-image" src="https://community.qlik.com/legacyfs/online/68313_Capture.PNG.png" style="width: 620px; height: 305px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;List box expression:&lt;/P&gt;&lt;P&gt;=FirstSortedValue( total &amp;lt;ID&amp;gt; Value,if(Flag=1,-RecordNumber))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chart expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=FirstSortedValue(TOTAL &amp;lt;ID&amp;gt; Value,if(Flag=1,-RecordNumber))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Load Script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET ThousandSep=',';&lt;/P&gt;&lt;P&gt;SET DecimalSep='.';&lt;/P&gt;&lt;P&gt;SET MoneyThousandSep=',';&lt;/P&gt;&lt;P&gt;SET MoneyDecimalSep='.';&lt;/P&gt;&lt;P&gt;SET MoneyFormat='$#,##0.00;($#,##0.00)';&lt;/P&gt;&lt;P&gt;SET TimeFormat='h:mm:ss TT';&lt;/P&gt;&lt;P&gt;SET DateFormat='M/D/YYYY';&lt;/P&gt;&lt;P&gt;SET TimestampFormat='M/D/YYYY h:mm:ss[.fff] TT';&lt;/P&gt;&lt;P&gt;SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';&lt;/P&gt;&lt;P&gt;SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Temp:&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;*,&lt;/P&gt;&lt;P&gt;RecNo() as RecordNumber,&lt;/P&gt;&lt;P&gt;if(Value &amp;lt; 0 and Previous(Value) &amp;lt; 0 , RecNo()-1,RecNo()) as [12Negative]&lt;/P&gt;&lt;P&gt;INLINE [ID, Date, Value&lt;/P&gt;&lt;P&gt;1, 1/1/2014, -3&lt;/P&gt;&lt;P&gt;1, 1/2/2014, -4&lt;/P&gt;&lt;P&gt;1, 1/3/2014, -9&lt;/P&gt;&lt;P&gt;1, 1/4/2014, -7&lt;/P&gt;&lt;P&gt;1, 1/5/2014, 6&lt;/P&gt;&lt;P&gt;1, 1/6/2014, 4&lt;/P&gt;&lt;P&gt;1, 1/7/2014, -5&lt;/P&gt;&lt;P&gt;1, 1/8/2014, -3&lt;/P&gt;&lt;P&gt;1, 1/9/2014, -7&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NoConcatenate&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp; *,&lt;/P&gt;&lt;P&gt;&amp;nbsp; if([12Negative]=Previous([12Negative]),1,0) as Flag&lt;/P&gt;&lt;P&gt;Resident Temp&lt;/P&gt;&lt;P&gt;Order by RecordNumber desc;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;drop table Temp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 06 Oct 2014 13:31:10 GMT</pubDate>
    <dc:creator>JonnyPoole</dc:creator>
    <dc:date>2014-10-06T13:31:10Z</dc:date>
    <item>
      <title>Return first data for last negative value period</title>
      <link>https://community.qlik.com/t5/QlikView/Return-first-data-for-last-negative-value-period/m-p/664255#M668910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need return first Date for last negative Value period.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table:&lt;/P&gt;&lt;P&gt;INLINE [ID, Date, Value&lt;/P&gt;&lt;P&gt;1, 1/1/2014, -3&lt;/P&gt;&lt;P&gt;1, 1/2/2014, -4&lt;/P&gt;&lt;P&gt;1, 1/3/2014, -9&lt;/P&gt;&lt;P&gt;1, 1/4/2014, -7 &lt;/P&gt;&lt;P&gt;1, 1/5/2014, 6&lt;/P&gt;&lt;P&gt;1, 1/6/2014, 4&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;1, 1/7/2014, -5&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1, 1/8/2014, -3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1, 1/9/2014, -7&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Need add field with marked 1/7/2014 for ID=1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for advice!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Ilgmar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2014 12:41:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Return-first-data-for-last-negative-value-period/m-p/664255#M668910</guid>
      <dc:creator />
      <dc:date>2014-10-06T12:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: Return first data for last negative value period</title>
      <link>https://community.qlik.com/t5/QlikView/Return-first-data-for-last-negative-value-period/m-p/664256#M668911</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How do you define last negative value? Do you select the row followed by last positive value(Here 4)?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2014 12:48:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Return-first-data-for-last-negative-value-period/m-p/664256#M668911</guid>
      <dc:creator>anbu1984</dc:creator>
      <dc:date>2014-10-06T12:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: Return first data for last negative value period</title>
      <link>https://community.qlik.com/t5/QlikView/Return-first-data-for-last-negative-value-period/m-p/664257#M668912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;not quite, becouse some ID can start with negative value and stay negative whole period, then it does not work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2014 12:58:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Return-first-data-for-last-negative-value-period/m-p/664257#M668912</guid>
      <dc:creator />
      <dc:date>2014-10-06T12:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: Return first data for last negative value period</title>
      <link>https://community.qlik.com/t5/QlikView/Return-first-data-for-last-negative-value-period/m-p/664258#M668913</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Then how do you identify last negative value?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2014 13:00:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Return-first-data-for-last-negative-value-period/m-p/664258#M668913</guid>
      <dc:creator>anbu1984</dc:creator>
      <dc:date>2014-10-06T13:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: Return first data for last negative value period</title>
      <link>https://community.qlik.com/t5/QlikView/Return-first-data-for-last-negative-value-period/m-p/664259#M668914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Definition:&lt;/P&gt;&lt;P&gt;if last report date ID value is negative, we need return data, when started last negative period. (In real, when it became as bad debitor)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it clear?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2014 13:03:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Return-first-data-for-last-negative-value-period/m-p/664259#M668914</guid>
      <dc:creator />
      <dc:date>2014-10-06T13:03:13Z</dc:date>
    </item>
    <item>
      <title>Re: Return first data for last negative value period</title>
      <link>https://community.qlik.com/t5/QlikView/Return-first-data-for-last-negative-value-period/m-p/664260#M668915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As I understand correctly, you need to add a flag to your table.&lt;/P&gt;&lt;P&gt;Your definition seems to be wrong what you need the result on the test data described above.&lt;/P&gt;&lt;P&gt;Please post some more data with test cases to understand the requirement clearly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2014 13:22:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Return-first-data-for-last-negative-value-period/m-p/664260#M668915</guid>
      <dc:creator />
      <dc:date>2014-10-06T13:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: Return first data for last negative value period</title>
      <link>https://community.qlik.com/t5/QlikView/Return-first-data-for-last-negative-value-period/m-p/664261#M668916</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Used some sorting in the load script to pick up the first negative value in the latest continous block of negative values:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG.png" class="jive-image" src="https://community.qlik.com/legacyfs/online/68313_Capture.PNG.png" style="width: 620px; height: 305px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;List box expression:&lt;/P&gt;&lt;P&gt;=FirstSortedValue( total &amp;lt;ID&amp;gt; Value,if(Flag=1,-RecordNumber))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chart expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=FirstSortedValue(TOTAL &amp;lt;ID&amp;gt; Value,if(Flag=1,-RecordNumber))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Load Script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET ThousandSep=',';&lt;/P&gt;&lt;P&gt;SET DecimalSep='.';&lt;/P&gt;&lt;P&gt;SET MoneyThousandSep=',';&lt;/P&gt;&lt;P&gt;SET MoneyDecimalSep='.';&lt;/P&gt;&lt;P&gt;SET MoneyFormat='$#,##0.00;($#,##0.00)';&lt;/P&gt;&lt;P&gt;SET TimeFormat='h:mm:ss TT';&lt;/P&gt;&lt;P&gt;SET DateFormat='M/D/YYYY';&lt;/P&gt;&lt;P&gt;SET TimestampFormat='M/D/YYYY h:mm:ss[.fff] TT';&lt;/P&gt;&lt;P&gt;SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';&lt;/P&gt;&lt;P&gt;SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Temp:&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;*,&lt;/P&gt;&lt;P&gt;RecNo() as RecordNumber,&lt;/P&gt;&lt;P&gt;if(Value &amp;lt; 0 and Previous(Value) &amp;lt; 0 , RecNo()-1,RecNo()) as [12Negative]&lt;/P&gt;&lt;P&gt;INLINE [ID, Date, Value&lt;/P&gt;&lt;P&gt;1, 1/1/2014, -3&lt;/P&gt;&lt;P&gt;1, 1/2/2014, -4&lt;/P&gt;&lt;P&gt;1, 1/3/2014, -9&lt;/P&gt;&lt;P&gt;1, 1/4/2014, -7&lt;/P&gt;&lt;P&gt;1, 1/5/2014, 6&lt;/P&gt;&lt;P&gt;1, 1/6/2014, 4&lt;/P&gt;&lt;P&gt;1, 1/7/2014, -5&lt;/P&gt;&lt;P&gt;1, 1/8/2014, -3&lt;/P&gt;&lt;P&gt;1, 1/9/2014, -7&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NoConcatenate&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp; *,&lt;/P&gt;&lt;P&gt;&amp;nbsp; if([12Negative]=Previous([12Negative]),1,0) as Flag&lt;/P&gt;&lt;P&gt;Resident Temp&lt;/P&gt;&lt;P&gt;Order by RecordNumber desc;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;drop table Temp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2014 13:31:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Return-first-data-for-last-negative-value-period/m-p/664261#M668916</guid>
      <dc:creator>JonnyPoole</dc:creator>
      <dc:date>2014-10-06T13:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: Return first data for last negative value period</title>
      <link>https://community.qlik.com/t5/QlikView/Return-first-data-for-last-negative-value-period/m-p/664262#M668917</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;So if your data doesn't have positive values, then you need Date - &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;1/1/2014?&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Table:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;INLINE [ID, Date, Value&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;1, 1/1/2014, -3&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;1, 1/2/2014, -4&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;1, 1/3/2014, -9&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;1, 1/4/2014, -7&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; text-decoration: underline;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;1, 1/7/2014, -5&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;1, 1/8/2014, -3&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;1, 1/9/2014, -7&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;];&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2014 13:36:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Return-first-data-for-last-negative-value-period/m-p/664262#M668917</guid>
      <dc:creator>anbu1984</dc:creator>
      <dc:date>2014-10-06T13:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: Return first data for last negative value period</title>
      <link>https://community.qlik.com/t5/QlikView/Return-first-data-for-last-negative-value-period/m-p/664263#M668918</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for advice!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2014 13:45:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Return-first-data-for-last-negative-value-period/m-p/664263#M668918</guid>
      <dc:creator />
      <dc:date>2014-10-06T13:45:26Z</dc:date>
    </item>
  </channel>
</rss>

