<?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 Min, Max(Datum) in expression, without variables in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Min-Max-Datum-in-expression-without-variables/m-p/133254#M9399</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have in my scripts an expression with variables, which gives wrong results and I want to rewrite it without variables, but I don't know how to write the MIN and Max of Datum, to obtain the results I need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the following example I'll explain what I need from MIN and MAX of Datum. As can be seen in the image bellow, the "min Datum" and "max Datum" are calculated for each row, which is NOT what I need. What I need is to have on each row the MIN and MAX of the selected Datum range. So in this case, the dates highlighted in yellow.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Question 1&lt;/STRONG&gt;: How do I write that?&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="213732" alt="minmax.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/213732_minmax.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Question 2: How do I write the new expression, based on the answer to question 1?&lt;A _jive_internal="true" class="j-modal-close-top close" href="https://community.qlik.com/discussion/create.jspa?sr=cmenu&amp;amp;containerType=14&amp;amp;containerID=1&amp;amp;draftID=1418042" title="Close Popup"&gt;&lt;BR /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are the variables and the expression (to be replaced):&lt;/P&gt;&lt;P&gt;Variables to replace:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;LET vDateStart &lt;/TD&gt;&lt;TD&gt;= '=Num(Min({'&amp;amp; chr(36)&amp;amp; '&amp;lt;%flagDisplay={1}&amp;gt;}Datum))';&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;LET vDateEnd &lt;/TD&gt;&lt;TD&gt;= '=Num(Max({'&amp;amp; chr(36)&amp;amp; '&amp;lt;%flagDisplay={1}&amp;gt;}Datum))';&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Variable to keep:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;SET setActuals &lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;= '{$&amp;lt;%flagDisplay={1}&amp;gt;}';&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expression to rewrite without the variables vDateStart and vDateEnd:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;LET mNewCCount&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;= 'SUM(' &amp;amp; Chr(36) &amp;amp; '(setActuals) IF([created_date] &amp;gt;= ' &amp;amp; Chr(36) &amp;amp; '(vDateStart) AND [created_date] &amp;lt;= ' &amp;amp; Chr(36) &amp;amp; '(vDateEnd), c_distinct_count))';&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And here is the NEW expression, without variables (but I don't know how to write the MIN and Max of Datum, to obtain the results I need):&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;=SUM($(setActuals) IF(num([created_date]) &amp;gt;= num(Min(Datum)) AND num([created_date]) &amp;lt;= num(Max(Datum)), c_distinct_count))&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" class="j-modal-close-top close" href="https://community.qlik.com/discussion/create.jspa?sr=cmenu&amp;amp;containerType=14&amp;amp;containerID=1&amp;amp;draftID=1418042" title="Close Popup"&gt;&lt;SPAN class="j-close-icon j-ui-elem"&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Sep 2018 13:45:45 GMT</pubDate>
    <dc:creator>adlisval</dc:creator>
    <dc:date>2018-09-17T13:45:45Z</dc:date>
    <item>
      <title>Min, Max(Datum) in expression, without variables</title>
      <link>https://community.qlik.com/t5/App-Development/Min-Max-Datum-in-expression-without-variables/m-p/133254#M9399</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have in my scripts an expression with variables, which gives wrong results and I want to rewrite it without variables, but I don't know how to write the MIN and Max of Datum, to obtain the results I need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the following example I'll explain what I need from MIN and MAX of Datum. As can be seen in the image bellow, the "min Datum" and "max Datum" are calculated for each row, which is NOT what I need. What I need is to have on each row the MIN and MAX of the selected Datum range. So in this case, the dates highlighted in yellow.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Question 1&lt;/STRONG&gt;: How do I write that?&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="213732" alt="minmax.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/213732_minmax.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Question 2: How do I write the new expression, based on the answer to question 1?&lt;A _jive_internal="true" class="j-modal-close-top close" href="https://community.qlik.com/discussion/create.jspa?sr=cmenu&amp;amp;containerType=14&amp;amp;containerID=1&amp;amp;draftID=1418042" title="Close Popup"&gt;&lt;BR /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are the variables and the expression (to be replaced):&lt;/P&gt;&lt;P&gt;Variables to replace:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;LET vDateStart &lt;/TD&gt;&lt;TD&gt;= '=Num(Min({'&amp;amp; chr(36)&amp;amp; '&amp;lt;%flagDisplay={1}&amp;gt;}Datum))';&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;LET vDateEnd &lt;/TD&gt;&lt;TD&gt;= '=Num(Max({'&amp;amp; chr(36)&amp;amp; '&amp;lt;%flagDisplay={1}&amp;gt;}Datum))';&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Variable to keep:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;SET setActuals &lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;= '{$&amp;lt;%flagDisplay={1}&amp;gt;}';&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expression to rewrite without the variables vDateStart and vDateEnd:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;LET mNewCCount&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;= 'SUM(' &amp;amp; Chr(36) &amp;amp; '(setActuals) IF([created_date] &amp;gt;= ' &amp;amp; Chr(36) &amp;amp; '(vDateStart) AND [created_date] &amp;lt;= ' &amp;amp; Chr(36) &amp;amp; '(vDateEnd), c_distinct_count))';&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And here is the NEW expression, without variables (but I don't know how to write the MIN and Max of Datum, to obtain the results I need):&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;=SUM($(setActuals) IF(num([created_date]) &amp;gt;= num(Min(Datum)) AND num([created_date]) &amp;lt;= num(Max(Datum)), c_distinct_count))&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" class="j-modal-close-top close" href="https://community.qlik.com/discussion/create.jspa?sr=cmenu&amp;amp;containerType=14&amp;amp;containerID=1&amp;amp;draftID=1418042" title="Close Popup"&gt;&lt;SPAN class="j-close-icon j-ui-elem"&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2018 13:45:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Min-Max-Datum-in-expression-without-variables/m-p/133254#M9399</guid>
      <dc:creator>adlisval</dc:creator>
      <dc:date>2018-09-17T13:45:45Z</dc:date>
    </item>
  </channel>
</rss>

