<?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 use variables and functions in a set Analysis chart function E() or P() in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/How-use-variables-and-functions-in-a-set-Analysis-chart-function/m-p/2499855#M103037</link>
    <description>&lt;P&gt;I'm stuck with some some set analysis in a chart function and cannot clearly find an answer if it is a limitation of Qlik or a misunderstanding from my side.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the expression of a KPI that goes like :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Count({&amp;lt;id = P({&amp;lt;start_date={"&amp;gt;31/12/2023"}&amp;gt;})&amp;gt; *
   &amp;lt;id = E({&amp;lt;end_date={"&amp;lt;=03/01/2025"}&amp;gt;})&amp;gt;} distinct id)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;which works well.&lt;/P&gt;
&lt;P&gt;(I use P() and E() in it because this looks like the best way to filter the way I want some null values on dates)&lt;/P&gt;
&lt;P&gt;now I want to generalize that expression and I'm trying to replace&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;31/12/2023&lt;/STRONG&gt; with &lt;STRONG&gt;$(vMyStartDateVariable)&lt;/STRONG&gt; and&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;03/01/2025&lt;/STRONG&gt; with &lt;STRONG&gt;Today()&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;but any of those 2 changes doesn't work.&lt;/P&gt;
&lt;P&gt;The validator at the bottom of the expression edition window says it is ok, but i wonder if the validator has a clue of what it's talking about because &lt;STRONG&gt;$(vMyStartDateVariable) &lt;/STRONG&gt;and&lt;STRONG&gt; Today()&lt;/STRONG&gt; are in a double quoted string and it seems like the parser only think it is text (syntax color stays green for the whole double quoted string).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any idea ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Jan 2025 08:43:38 GMT</pubDate>
    <dc:creator>rdugg</dc:creator>
    <dc:date>2025-01-03T08:43:38Z</dc:date>
    <item>
      <title>How use variables and functions in a set Analysis chart function E() or P()</title>
      <link>https://community.qlik.com/t5/App-Development/How-use-variables-and-functions-in-a-set-Analysis-chart-function/m-p/2499855#M103037</link>
      <description>&lt;P&gt;I'm stuck with some some set analysis in a chart function and cannot clearly find an answer if it is a limitation of Qlik or a misunderstanding from my side.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the expression of a KPI that goes like :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Count({&amp;lt;id = P({&amp;lt;start_date={"&amp;gt;31/12/2023"}&amp;gt;})&amp;gt; *
   &amp;lt;id = E({&amp;lt;end_date={"&amp;lt;=03/01/2025"}&amp;gt;})&amp;gt;} distinct id)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;which works well.&lt;/P&gt;
&lt;P&gt;(I use P() and E() in it because this looks like the best way to filter the way I want some null values on dates)&lt;/P&gt;
&lt;P&gt;now I want to generalize that expression and I'm trying to replace&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;31/12/2023&lt;/STRONG&gt; with &lt;STRONG&gt;$(vMyStartDateVariable)&lt;/STRONG&gt; and&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;03/01/2025&lt;/STRONG&gt; with &lt;STRONG&gt;Today()&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;but any of those 2 changes doesn't work.&lt;/P&gt;
&lt;P&gt;The validator at the bottom of the expression edition window says it is ok, but i wonder if the validator has a clue of what it's talking about because &lt;STRONG&gt;$(vMyStartDateVariable) &lt;/STRONG&gt;and&lt;STRONG&gt; Today()&lt;/STRONG&gt; are in a double quoted string and it seems like the parser only think it is text (syntax color stays green for the whole double quoted string).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any idea ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2025 08:43:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-use-variables-and-functions-in-a-set-Analysis-chart-function/m-p/2499855#M103037</guid>
      <dc:creator>rdugg</dc:creator>
      <dc:date>2025-01-03T08:43:38Z</dc:date>
    </item>
    <item>
      <title>Re: How use variables and functions in a set Analysis chart function E() or P()</title>
      <link>https://community.qlik.com/t5/App-Development/How-use-variables-and-functions-in-a-set-Analysis-chart-function/m-p/2499862#M103038</link>
      <description>&lt;P&gt;Variables will be working for such scenarios but the way how they are created and which kind of data the values have will depend the syntax of the calls in regard to the used context. And yes, sometimes it could become tricky ...&lt;/P&gt;
&lt;P&gt;For testing reasons I suggest to split the task into two parts - maybe like:&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Count({&amp;lt;id = P({&amp;lt;start_date={"&amp;gt;vMyStartDateVariable"}&amp;gt;})&amp;gt;} distinct id)&lt;/LI-CODE&gt;
&lt;P&gt;and&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Count(&amp;lt;id = E({&amp;lt;end_date={"&amp;lt;=$(=today())"}&amp;gt;})&amp;gt;} distinct id)&lt;/LI-CODE&gt;
&lt;P&gt;to simplify the troubleshooting which just provide some alternate ways to set the calls but the most complexity will remain because the variables contains string-values which needs to be interpreted as numbers in the wanted way.&lt;/P&gt;
&lt;P&gt;Much more simple is to use pure numbers, maybe created like:&lt;/P&gt;
&lt;P&gt;vStart: num(makedate(2023,12,31))&lt;BR /&gt;vEnd: num(today())&lt;/P&gt;
&lt;P&gt;and then it may look like:&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Count({&amp;lt;id = P({&amp;lt;start_date={"&amp;gt;$(vStart)"}&amp;gt;})&amp;gt; *
   &amp;lt;id = E({&amp;lt;end_date={"&amp;lt;=$(vEnd)&amp;gt;})&amp;gt;} distinct id)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2025 10:13:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-use-variables-and-functions-in-a-set-Analysis-chart-function/m-p/2499862#M103038</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2025-01-03T10:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: How use variables and functions in a set Analysis chart function E() or P()</title>
      <link>https://community.qlik.com/t5/App-Development/How-use-variables-and-functions-in-a-set-Analysis-chart-function/m-p/2499868#M103039</link>
      <description>&lt;P&gt;I think I have found a solution&lt;/P&gt;
&lt;P&gt;with the help of these explanations&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.qlik.com/t5/Design/The-Magic-of-Variables/ba-p/1465499" target="_blank"&gt;https://community.qlik.com/t5/Design/The-Magic-of-Variables/ba-p/1465499&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;and the key to late computation of a variable value with the preceding equal :&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/3996" target="_blank"&gt;https://community.qlik.com/qlik-blogpost/3996&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2025 11:09:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-use-variables-and-functions-in-a-set-Analysis-chart-function/m-p/2499868#M103039</guid>
      <dc:creator>rdugg</dc:creator>
      <dc:date>2025-01-03T11:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: How use variables and functions in a set Analysis chart function E() or P()</title>
      <link>https://community.qlik.com/t5/App-Development/How-use-variables-and-functions-in-a-set-Analysis-chart-function/m-p/2499872#M103042</link>
      <description>&lt;P&gt;So this part wasn't working&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;STRONG&gt;31/12/2023&lt;/STRONG&gt; with &lt;STRONG&gt;$(vMyStartDateVariable)&lt;/STRONG&gt; &lt;/P&gt;
&lt;P&gt;because my variable wasn't in the right format. I added a Date(xxx, "DD/MM/YYY") to it&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For this one,&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;STRONG&gt;03/01/2025&lt;/STRONG&gt; with &lt;STRONG&gt;Today()&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Your example made me learn about the ${&lt;FONT color="#FF6600"&gt;&lt;STRONG&gt;=&lt;/STRONG&gt;&lt;/FONT&gt;function_call()}&lt;/P&gt;
&lt;P&gt;which I wasn't aware existed.&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2025 11:34:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-use-variables-and-functions-in-a-set-Analysis-chart-function/m-p/2499872#M103042</guid>
      <dc:creator>rdugg</dc:creator>
      <dc:date>2025-01-03T11:34:43Z</dc:date>
    </item>
  </channel>
</rss>

