<?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: Set analysis  max value smaller than in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37718#M6400</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;it doesn't yield the desired results anymore ..&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Does it yield any result? Do you know what might it be doing incorrectly? Difficult to know unless you are able to share more details or a sample?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 May 2018 12:20:19 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2018-05-16T12:20:19Z</dc:date>
    <item>
      <title>Set analysis  max value smaller than</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37713#M6395</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello dear Qlikview community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm struggling with no luck with the following problem, perhaps you could give me a hint:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to sum up all values pertaining to the maximum reported date, but smaller than another given value, in a Pivot Table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That is, &lt;/P&gt;&lt;P&gt;- we have the current date: let's say 201806 (yyyymm)&lt;/P&gt;&lt;P&gt;- we have the chart with dimension Product&lt;/P&gt;&lt;P&gt;- for each product, there are multiple series of sales values, pertaining to different reported dates, say: 201804, 201801, 201711 (not all products have reported for a given date! )&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Products :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;A&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;B&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Sales (report_date, product, sales):&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;201806&amp;nbsp; A&amp;nbsp;&amp;nbsp; 50&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'courier new', courier;"&gt;201806&amp;nbsp; A&amp;nbsp;&amp;nbsp; 30&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'courier new', courier;"&gt;201804&amp;nbsp; A&amp;nbsp;&amp;nbsp; 20&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'courier new', courier;"&gt;201804&amp;nbsp; A&amp;nbsp;&amp;nbsp; 30&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;201806&amp;nbsp; B&amp;nbsp;&amp;nbsp; 20&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'courier new', courier;"&gt;201806&amp;nbsp; B&amp;nbsp;&amp;nbsp; 20&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'courier new', courier;"&gt;201801&amp;nbsp; B&amp;nbsp;&amp;nbsp; 20&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'courier new', courier;"&gt;201801&amp;nbsp; B&amp;nbsp;&amp;nbsp; 15&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;I'm looking for:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'courier new', courier;"&gt;sum( {1&amp;lt; report_date={Greatest_YYYMM_date_but_Smaller_than_current_selection}&amp;nbsp; &amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'courier new', courier;"&gt;sales )&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I've tried many variants along the lines:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;sum( {1&amp;lt; report_date={ `= $(= max({1&amp;lt; report_date={"$(= '&amp;lt;'&amp;amp; vSelectedSubmission)"} &amp;gt;} report_date )&amp;nbsp; )` }&amp;nbsp; &amp;gt;} sales)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can i get this working, what am i missing?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result should be somewhat like:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;product&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; previous_report&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; current_report&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 80&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 35&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 40&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for any ideas.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2018 17:22:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37713#M6395</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-05-15T17:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis  max value smaller than</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37714#M6396</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FirstSortedValue({&amp;lt;report_date = {"$(='&amp;lt;=' &amp;amp; Max(report_date))"}&amp;gt;} Aggr(Sum({&amp;lt;report_date = {"$(='&amp;lt;=' &amp;amp; Max(report_date))"}&amp;gt;} sales), report_date, product), -Aggr(Only({&amp;lt;report_date = {"$(='&amp;lt;=' &amp;amp; Max(report_date))"}&amp;gt;} report_date), report_date, product))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2018 17:27:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37714#M6396</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-05-15T17:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis  max value smaller than</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37715#M6397</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For previous&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;FirstSortedValue({&amp;lt;report_date = {"$(='&amp;lt;=' &amp;amp; Max(report_date))"}&amp;gt;} Aggr(Sum({&amp;lt;report_date = {"$(='&amp;lt;=' &amp;amp; Max(report_date))"}&amp;gt;} sales), report_date, product), -Aggr(Only({&amp;lt;report_date = {"$(='&amp;lt;=' &amp;amp; Max(report_date))"}&amp;gt;} report_date), report_date, product), 2)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2018 17:27:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37715#M6397</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-05-15T17:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis  max value smaller than</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37716#M6398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sample image and qvw attached&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/202481_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2018 17:43:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37716#M6398</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-05-15T17:43:08Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis  max value smaller than</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37717#M6399</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Sunny and thank you very much for your so quick answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your script does exactly what i'm looking for, &lt;/P&gt;&lt;P&gt;However, for some reason, when i port it in my application, it doesn't yield the desired results anymore .. still trying around your answer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2018 12:18:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37717#M6399</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-05-16T12:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis  max value smaller than</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37718#M6400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;it doesn't yield the desired results anymore ..&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Does it yield any result? Do you know what might it be doing incorrectly? Difficult to know unless you are able to share more details or a sample?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2018 12:20:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37718#M6400</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-05-16T12:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis  max value smaller than</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37719#M6401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It doesn't yield any results.&lt;/P&gt;&lt;P&gt;If i use 1 as rank for the FirstSortedValue parameter, i do get the current values, if i use 2, to retrieve the second record, nothing, nowhere comes up.&lt;/P&gt;&lt;P&gt;Btw, can you explain why using 'only' and not for example 'max' ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2018 13:14:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37719#M6401</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-05-16T13:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis  max value smaller than</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37720#M6402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try adding a DISTINCT after FirstSortedValue()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;FirstSortedValue(&lt;SPAN style="color: #ff0000;"&gt;DISTINCT&lt;/SPAN&gt; {&amp;lt;report_date = {"$(='&amp;lt;=' &amp;amp; Max(report_date))"}&amp;gt;} Aggr(Sum({&amp;lt;report_date = {"$(='&amp;lt;=' &amp;amp; Max(report_date))"}&amp;gt;} sales), report_date, product), -Aggr(Only({&amp;lt;report_date = {"$(='&amp;lt;=' &amp;amp; Max(report_date))"}&amp;gt;} report_date), report_date, product), 2)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2018 13:16:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37720#M6402</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-05-16T13:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis  max value smaller than</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37721#M6403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, ok i found the reason why it does not yield anything, though i did not also find the solution &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/plain.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a filter for report_date. The report_date is being selected, that's what i need for the 'current report date', let's call it a 'reference date', hence the 'previous date' is whatever is earlier than this selection.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2018 13:18:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37721#M6403</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-05-16T13:18:25Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis  max value smaller than</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37722#M6404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I did add a set analysis to handle this problem... but it might not be working... what is the format for report_date?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2018 13:20:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37722#M6404</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-05-16T13:20:28Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis  max value smaller than</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37723#M6405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sunny, i can not thank you enough for your support &lt;/P&gt;&lt;P&gt;however, it's not about my selection, and it doesn't work with distinct, or without it. First sorted value with rank 1 does return the current value, when i set it to 2, nothing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2018 15:34:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37723#M6405</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-05-16T15:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis  max value smaller than</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37724#M6406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But didn't you say this?&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;I have a filter for report_date. The report_date is being selected, that's what i need for the 'current report date', let's call it a 'reference date', hence the 'previous date' is whatever is earlier than this selection.&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2018 16:03:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37724#M6406</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-05-16T16:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis  max value smaller than</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37725#M6407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-users/171708"&gt;stalwar1&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I couldn't get it working directly as you mentioned it, and i'm not sure why, but your example file works and is doing exactly what i was looking for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, i had to tweak the formula on my end and manually include the selections, it looks as follows:&lt;/P&gt;&lt;PRE style="background: #e0e0e0;"&gt;
&lt;P&gt;FirstSortedValue({1&amp;lt;report_date = {"$(='&amp;lt;=' &amp;amp; vSelectedReportDate )"}, year={$(vGlobalYear1)}, country=p(country), product=p(product) &amp;gt;}&lt;/P&gt;
&lt;P&gt;Aggr(sum({1&amp;lt;report_date = {"$(='&amp;lt;=' &amp;amp; vSelectedReportDate )"}, year={$(vGlobalYear1)}, country=p(country), product=p(product)&amp;gt;} alt(marketing,0)), report_date, product)&lt;/P&gt;
&lt;P&gt;, -Aggr(Only({1&amp;lt;report_date = {"$(='&amp;lt;=' &amp;amp; vSelectedReportDate )"}, year={$(vGlobalYear1)}, country=p(country), product=p(product)&amp;gt;} report_date),&lt;/P&gt;
&lt;P&gt;report_date,&lt;/P&gt;
&lt;P&gt;product),&lt;/P&gt;
&lt;P&gt;2)&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As far as i have checked, it yields the expected results. My formula includes other filters as i have them in my file&lt;/P&gt;&lt;P&gt;(product and country), as well as the year , which is yet another field in the products data table ( i had initially left this out for simplicity).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2018 11:36:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-max-value-smaller-than/m-p/37725#M6407</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-05-23T11:36:01Z</dc:date>
    </item>
  </channel>
</rss>

