<?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 How to use Peek/Previous for multiple dimension values? in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/How-to-use-Peek-Previous-for-multiple-dimension-values/m-p/2112343#M90856</link>
    <description>&lt;P&gt;Dear all,&lt;/P&gt;
&lt;P&gt;Can anyone help me out with a challenge?&lt;/P&gt;
&lt;P&gt;I need the max date for each Name but with the condition that if that max date is higher than today I need the next date.&lt;/P&gt;
&lt;P&gt;For each Name I need only 1 date in the output.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data is already sorted DESC&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Input&lt;/P&gt;
&lt;P&gt;Table1&lt;/P&gt;
&lt;P&gt;Name,Date&lt;BR /&gt;A,2-9-2023&lt;BR /&gt;A,30-8-2023&lt;BR /&gt;A,25-1-2023&lt;BR /&gt;B,1-1-2023&lt;BR /&gt;B,5-5-2022&lt;/P&gt;
&lt;P&gt;Expected Output&lt;/P&gt;
&lt;P&gt;A,30-8-2023&lt;BR /&gt;B,1-1-2023&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My idea was to use an expression like&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;distinct Name,&lt;/P&gt;
&lt;P&gt;If(Peek(Date)&amp;gt;today(),previous(Date),Peek(Date)&lt;/P&gt;
&lt;P&gt;Resident Table1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This didn't work. Curious for your thoughts.&lt;/P&gt;
&lt;P&gt;Thanks in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 01 Sep 2023 14:11:09 GMT</pubDate>
    <dc:creator>Henk_The_Novice</dc:creator>
    <dc:date>2023-09-01T14:11:09Z</dc:date>
    <item>
      <title>How to use Peek/Previous for multiple dimension values?</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-use-Peek-Previous-for-multiple-dimension-values/m-p/2112343#M90856</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;
&lt;P&gt;Can anyone help me out with a challenge?&lt;/P&gt;
&lt;P&gt;I need the max date for each Name but with the condition that if that max date is higher than today I need the next date.&lt;/P&gt;
&lt;P&gt;For each Name I need only 1 date in the output.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data is already sorted DESC&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Input&lt;/P&gt;
&lt;P&gt;Table1&lt;/P&gt;
&lt;P&gt;Name,Date&lt;BR /&gt;A,2-9-2023&lt;BR /&gt;A,30-8-2023&lt;BR /&gt;A,25-1-2023&lt;BR /&gt;B,1-1-2023&lt;BR /&gt;B,5-5-2022&lt;/P&gt;
&lt;P&gt;Expected Output&lt;/P&gt;
&lt;P&gt;A,30-8-2023&lt;BR /&gt;B,1-1-2023&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My idea was to use an expression like&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;distinct Name,&lt;/P&gt;
&lt;P&gt;If(Peek(Date)&amp;gt;today(),previous(Date),Peek(Date)&lt;/P&gt;
&lt;P&gt;Resident Table1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This didn't work. Curious for your thoughts.&lt;/P&gt;
&lt;P&gt;Thanks in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2023 14:11:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-use-Peek-Previous-for-multiple-dimension-values/m-p/2112343#M90856</guid>
      <dc:creator>Henk_The_Novice</dc:creator>
      <dc:date>2023-09-01T14:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Peek/Previous for multiple dimension values?</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-use-Peek-Previous-for-multiple-dimension-values/m-p/2112367#M90859</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;You can try a sxript like this:&lt;/P&gt;
&lt;P&gt;data:&lt;BR /&gt;Load&lt;BR /&gt;Name, &lt;BR /&gt;Date#(Date, 'D-M-YYYY') as Date&lt;BR /&gt;Inline [&lt;BR /&gt;Name,Date&lt;BR /&gt;A,2-9-2023&lt;BR /&gt;A,30-8-2023&lt;BR /&gt;A,25-1-2023&lt;BR /&gt;B,1-1-2023&lt;BR /&gt;B,5-5-2022&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;NoConcatenate&lt;BR /&gt;Load&lt;BR /&gt;Name,&lt;BR /&gt;Max(Date) as Date&lt;BR /&gt;Where&lt;BR /&gt;FLG_DATE = 1&lt;BR /&gt;Group By &lt;BR /&gt;Name&lt;BR /&gt;;&lt;BR /&gt;Load&lt;BR /&gt;Name,&lt;BR /&gt;Date,&lt;BR /&gt;If(Date &amp;lt;= Today(), 1, 0) as FLG_DATE&lt;BR /&gt;Resident data&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;Drop Table data;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2023 14:50:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-use-Peek-Previous-for-multiple-dimension-values/m-p/2112367#M90859</guid>
      <dc:creator>Aurelien_Martinez</dc:creator>
      <dc:date>2023-09-01T14:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Peek/Previous for multiple dimension values?</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-use-Peek-Previous-for-multiple-dimension-values/m-p/2112373#M90861</link>
      <description>&lt;P&gt;Dear Aurelien,&lt;/P&gt;
&lt;P&gt;Thanks for your reply. I copied the script and it is working. It took me some time to understand your logic but now it's clear.&amp;nbsp;I was assuming that I needed the Peek/Previous but probably the lack of the DATE function it was not working. Thanks for your creative solution with the MAX function.&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2023 15:03:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-use-Peek-Previous-for-multiple-dimension-values/m-p/2112373#M90861</guid>
      <dc:creator>Henk_The_Novice</dc:creator>
      <dc:date>2023-09-01T15:03:13Z</dc:date>
    </item>
  </channel>
</rss>

