<?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: Latest values for latest date based on selection in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Latest-values-for-latest-date-based-on-selection/m-p/1825635#M67865</link>
    <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/146612"&gt;@Santosh_K&lt;/a&gt;&amp;nbsp; If I understood it correctly, you can try something like below. Make sure that "Include zero values" option is checked in add-on-&amp;gt;data handling&amp;nbsp;&lt;/P&gt;&lt;P&gt;if(GetSelectedCount(Div)=0, FirstSortedValue(distinct {&amp;lt;Date={"&amp;lt;=$(=date(max(Date)))"}&amp;gt;}Value, - Date),&lt;BR /&gt;sum(distinct {&amp;lt;Date={"$(=date(max(Date)))"}&amp;gt;}Value))&lt;/P&gt;</description>
    <pubDate>Thu, 29 Jul 2021 22:01:06 GMT</pubDate>
    <dc:creator>Kushal_Chawda</dc:creator>
    <dc:date>2021-07-29T22:01:06Z</dc:date>
    <item>
      <title>Latest values for latest date based on selection</title>
      <link>https://community.qlik.com/t5/App-Development/Latest-values-for-latest-date-based-on-selection/m-p/1825544#M67848</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I need help on below scenario. I have data as below&lt;/P&gt;&lt;P&gt;LOAD * Inline [&lt;BR /&gt;Acct,Div,Date,Value&lt;BR /&gt;1,a,01/01/2021,100&lt;BR /&gt;1,b,01/02/2021,60&lt;BR /&gt;1,b,01/03/2021,80&lt;BR /&gt;2,b,01/01/2021,90&lt;BR /&gt;2,a,01/02/2021,50&lt;BR /&gt;2,a,01/03/2021,70]&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Let's say I have selected month 01/03/2021 and Div is not selected&lt;/STRONG&gt; I would always like to show latest Value for Acct. If for that period value is not available, need to go back to previous periods to select latest available Value. I am using below measure which is working fine in this case&lt;/P&gt;&lt;P&gt;FirstSortedValue(distinct {&amp;lt;Date ={"&amp;lt;=$(vMaxDate)"}&amp;gt;} Value, -Date)&lt;/P&gt;&lt;P&gt;where vMaxDate = max(Date)&lt;/P&gt;&lt;P&gt;Now, &lt;STRONG&gt;when I select&lt;/STRONG&gt;&amp;nbsp;&lt;STRONG&gt;month 01/03/2021 and Div = 'a' ,&lt;/STRONG&gt; for Acct =1, I would like to show value as 0, because for this Acct, latest Date has Div=b. Similarly, for Acct=2, I would like to show value as 70, because for this Acct, latest Date has Div=a&lt;/P&gt;&lt;P&gt;Acct&amp;nbsp; &amp;nbsp;Value&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;70&lt;/P&gt;&lt;P&gt;In short, when I select any Div, particular Acct should only get value if that Acct's latest Date has that selected Div.&lt;/P&gt;&lt;P&gt;Similarly,&amp;nbsp;&lt;STRONG&gt;when I select&lt;/STRONG&gt;&amp;nbsp;&lt;STRONG&gt;month 01/03/2021 and Div = 'b' ,&amp;nbsp;&lt;/STRONG&gt; I should get below&lt;/P&gt;&lt;P&gt;Acct&amp;nbsp; &amp;nbsp;Value&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;80&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;&lt;P&gt;I am not able to get around the expression when particular Div is selected&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jul 2021 14:56:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Latest-values-for-latest-date-based-on-selection/m-p/1825544#M67848</guid>
      <dc:creator>Santosh_K</dc:creator>
      <dc:date>2021-07-29T14:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: Latest values for latest date based on selection</title>
      <link>https://community.qlik.com/t5/App-Development/Latest-values-for-latest-date-based-on-selection/m-p/1825635#M67865</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/146612"&gt;@Santosh_K&lt;/a&gt;&amp;nbsp; If I understood it correctly, you can try something like below. Make sure that "Include zero values" option is checked in add-on-&amp;gt;data handling&amp;nbsp;&lt;/P&gt;&lt;P&gt;if(GetSelectedCount(Div)=0, FirstSortedValue(distinct {&amp;lt;Date={"&amp;lt;=$(=date(max(Date)))"}&amp;gt;}Value, - Date),&lt;BR /&gt;sum(distinct {&amp;lt;Date={"$(=date(max(Date)))"}&amp;gt;}Value))&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jul 2021 22:01:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Latest-values-for-latest-date-based-on-selection/m-p/1825635#M67865</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2021-07-29T22:01:06Z</dc:date>
    </item>
  </channel>
</rss>

