<?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 Search for the smallest closest date to the filter in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Search-for-the-smallest-closest-date-to-the-filter/m-p/1995246#M82374</link>
    <description>&lt;P&gt;Hi all!&lt;/P&gt;
&lt;P&gt;There are two tables:&lt;BR /&gt;1. A loaded table with the dates of changes in the prices of the product:&lt;BR /&gt;01.03.2021 100&lt;BR /&gt;02.05.2021 120&lt;BR /&gt;04/04/2022 130&lt;BR /&gt;06.06.2022 160&lt;/P&gt;
&lt;P&gt;2. A standard table with a calendar that is used for the filter.&lt;/P&gt;
&lt;P&gt;Necessary:&lt;BR /&gt;In the interface when setting the filter by date, display the price closest to the filter date (the price that acted on the date of the filter)&lt;/P&gt;
&lt;P&gt;Example 1: The value of the filter "05.05.2022" should be displayed the next price to this date: "130" (was set 05.05.2022)&lt;BR /&gt;Example 2: The value of the filter "07.03.2021" should be displayed the next price to this date: "100" (was set 03.03.2021)&lt;/P&gt;
&lt;P&gt;The loading script is undesirable, better through the interface.&lt;BR /&gt;I will be very glad to help&lt;/P&gt;</description>
    <pubDate>Thu, 20 Oct 2022 20:17:44 GMT</pubDate>
    <dc:creator>Dommnn</dc:creator>
    <dc:date>2022-10-20T20:17:44Z</dc:date>
    <item>
      <title>Search for the smallest closest date to the filter</title>
      <link>https://community.qlik.com/t5/App-Development/Search-for-the-smallest-closest-date-to-the-filter/m-p/1995246#M82374</link>
      <description>&lt;P&gt;Hi all!&lt;/P&gt;
&lt;P&gt;There are two tables:&lt;BR /&gt;1. A loaded table with the dates of changes in the prices of the product:&lt;BR /&gt;01.03.2021 100&lt;BR /&gt;02.05.2021 120&lt;BR /&gt;04/04/2022 130&lt;BR /&gt;06.06.2022 160&lt;/P&gt;
&lt;P&gt;2. A standard table with a calendar that is used for the filter.&lt;/P&gt;
&lt;P&gt;Necessary:&lt;BR /&gt;In the interface when setting the filter by date, display the price closest to the filter date (the price that acted on the date of the filter)&lt;/P&gt;
&lt;P&gt;Example 1: The value of the filter "05.05.2022" should be displayed the next price to this date: "130" (was set 05.05.2022)&lt;BR /&gt;Example 2: The value of the filter "07.03.2021" should be displayed the next price to this date: "100" (was set 03.03.2021)&lt;/P&gt;
&lt;P&gt;The loading script is undesirable, better through the interface.&lt;BR /&gt;I will be very glad to help&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2022 20:17:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Search-for-the-smallest-closest-date-to-the-filter/m-p/1995246#M82374</guid>
      <dc:creator>Dommnn</dc:creator>
      <dc:date>2022-10-20T20:17:44Z</dc:date>
    </item>
    <item>
      <title>Re: Search for the smallest closest date to the filter</title>
      <link>https://community.qlik.com/t5/App-Development/Search-for-the-smallest-closest-date-to-the-filter/m-p/1995451#M82396</link>
      <description>&lt;P&gt;as below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;temp:
load Date(date#(date,'MM.DD.YYYY')) as DATE,value inline [
date,value
01.03.2021,100
02.05.2021,120
04.04.2022,130
06.06.2022,160
];


Calendar:
  LOAD Date(_DateStart+(Iterno()-1),'$(DateFormat)' ) as [DATE]
               While (_DateStart+(Iterno()-1)&amp;lt;=_DateStop);
        LOAD
               Floor(Min(Fieldvalue('DATE',RecNo()))) as _DateStart,
               Floor(Max(Fieldvalue('DATE',RecNo()))) as _DateStop
        AUTOGENERATE FieldValueCount('DATE');

exit Script;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In chart:&lt;/P&gt;
&lt;P&gt;Dimensions:&lt;/P&gt;
&lt;P&gt;recordid&lt;/P&gt;
&lt;P&gt;DATE&lt;/P&gt;
&lt;P&gt;Measure:&lt;/P&gt;
&lt;P&gt;sum({1}value)&amp;nbsp; // for checking&lt;/P&gt;
&lt;P&gt;the below measure will show results&lt;FONT face="arial black,avant garde" size="4" color="#FF6600"&gt;&lt;STRONG&gt; for &lt;U&gt;next&lt;/U&gt; possible date&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;sum({&amp;lt;DATE={"$(=Min({&amp;lt; recordid=p({&amp;lt;DATE={"&amp;gt;$(=Max(DATE))"}&amp;gt;} recordid) , DATE= &amp;gt;}total DATE))"} &amp;gt;} value)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you can add a condition as below&lt;/P&gt;
&lt;P&gt;=if(sum(value),sum(value),&amp;nbsp;&lt;SPAN&gt;sum({&amp;lt;DATE={"$(=Min({&amp;lt; recordid=p({&amp;lt;DATE={"&amp;gt;$(=Max(DATE))"}&amp;gt;} recordid) , DATE= &amp;gt;}total DATE))"} &amp;gt;} value) )&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 09:25:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Search-for-the-smallest-closest-date-to-the-filter/m-p/1995451#M82396</guid>
      <dc:creator>vinieme12</dc:creator>
      <dc:date>2022-10-21T09:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: Search for the smallest closest date to the filter</title>
      <link>https://community.qlik.com/t5/App-Development/Search-for-the-smallest-closest-date-to-the-filter/m-p/1997253#M82581</link>
      <description>&lt;P&gt;Thanks a lot! it works!&lt;/P&gt;
&lt;P&gt;I have one additional&amp;nbsp; task , i have similar table with the name of the goods.&lt;BR /&gt;The name changes in time, below is an example.&lt;BR /&gt;Accordingly, i need to find out what name the product had at a certain period of time.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i need to know&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;results&lt;/SPAN&gt;&lt;FONT face="arial black,avant garde" size="4" color="#FF6600"&gt;&lt;STRONG&gt;&amp;nbsp;for&amp;nbsp;&lt;U&gt;previous&lt;/U&gt;&amp;nbsp;possible date&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;For example if&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;value of the filter&amp;nbsp; is "19.07.2021" should be displayed&amp;nbsp; "Name2" (was set&amp;nbsp; at 15.05.2021 and changed in 21.04.2022&amp;nbsp;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Table:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;17.03.2021 Name1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;15.05.2021 Name2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;21.04.2022&amp;nbsp;Name3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;18.06.2022&amp;nbsp;Name4&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 18:01:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Search-for-the-smallest-closest-date-to-the-filter/m-p/1997253#M82581</guid>
      <dc:creator>Dommnn_2022</dc:creator>
      <dc:date>2022-10-26T18:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: Search for the smallest closest date to the filter</title>
      <link>https://community.qlik.com/t5/App-Development/Search-for-the-smallest-closest-date-to-the-filter/m-p/1997627#M82626</link>
      <description>&lt;P&gt;&lt;FONT color="#FF6600"&gt;just the below changes&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;sum({&amp;lt;DATE={"$(=&lt;STRONG&gt;&lt;FONT color="#FF6600"&gt;Max&lt;/FONT&gt;&lt;/STRONG&gt;({&amp;lt; recordid=p({&amp;lt;DATE={"&lt;STRONG&gt;&lt;FONT color="#FF6600"&gt;&amp;lt;&lt;/FONT&gt;&lt;/STRONG&gt;$(=Max(DATE))"}&amp;gt;} recordid) , DATE= &amp;gt;}total DATE))"} &amp;gt;} value)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 13:35:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Search-for-the-smallest-closest-date-to-the-filter/m-p/1997627#M82626</guid>
      <dc:creator>vinieme12</dc:creator>
      <dc:date>2022-10-27T13:35:53Z</dc:date>
    </item>
  </channel>
</rss>

