<?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: Variable within Expression within Set Analysis in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Variable-within-Expression-within-Set-Analysis/m-p/2044273#M85935</link>
    <description>&lt;P&gt;Ohh, I was so close - this fixed it!&lt;/P&gt;
&lt;P&gt;Thank you, henrikalmen.&lt;/P&gt;</description>
    <pubDate>Thu, 02 Mar 2023 07:20:19 GMT</pubDate>
    <dc:creator>gaber</dc:creator>
    <dc:date>2023-03-02T07:20:19Z</dc:date>
    <item>
      <title>Variable within Expression within Set Analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Variable-within-Expression-within-Set-Analysis/m-p/2044190#M85930</link>
      <description>&lt;P&gt;Using Qlik Sense, I have a relatively complex SQL query which is to be visualised within the &lt;EM&gt;P&amp;amp;L chart&lt;/EM&gt;. The data is aggregated monthly, but I need only the chose month to be filtered out at a time.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As this chosen month needs to be used across the App, I need it to be a variable - &lt;STRONG&gt;vEndOfReportingMonth&lt;/STRONG&gt; which is a date formatted 'MMM YYYY' for readability purposes.&lt;/P&gt;
&lt;P&gt;Using a&amp;nbsp;&lt;EM&gt;Variable Input&lt;/EM&gt; chart for this variable, I set the dynamic values using the function below, limiting the choices from the previous month the start of the reporting dataset.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;=Concat({&amp;lt;MonthYearShort -= {"$(=Text(Date(Today(), 'MMM YYYY')))"}&amp;gt;} Distinct Date(MonthEnd(PaidDate), 'MMM YYYY'), '|', -[PaidDate.autoCalendar.YearMonth])&lt;/LI-CODE&gt;
&lt;P&gt;I understand the &lt;EM&gt;Variable Input&lt;/EM&gt; tool returns the result as a string, not as a date. I plan on using it to filter data date formatted as YYYYMM, so for it to be used as a date, I need to do something along the lines of the following:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;=Date(MonthEnd(Date#('$(vEndOfReportingMonth)', 'MMM YYYY')),'YYYYMM')&lt;/LI-CODE&gt;
&lt;P&gt;Wonderful, now I want to use this variable in a set expression to filter data using the [Reporting YYYYMM] field. However, I simply cannot get the script to work, basing it off a structure like below. It seems to ignore the filtering and return all values.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sum({&amp;lt;[Reporting YYYYMM] = {"=(Date(Date#('$(vEndOfReportingMonth)', 'MMM YYYY'),'YYYYMM'))"}&amp;gt;} Value)&lt;/LI-CODE&gt;
&lt;P&gt;If I simplify the code to test data types, the code below effectively filters the data, so it appears Text works.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sum({&amp;lt;[Reporting YYYYMM] = {'202212'}&amp;gt;} Value)&lt;/LI-CODE&gt;
&lt;P&gt;But when I try converting the variable to Text() like so, zeroes are returned.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sum({&amp;lt;[Reporting YYYYMM] = {"=(Text(Date(Date#('$(vEndOfReportingMonth)', 'MMM YYYY'),'YYYYMM')))"}&amp;gt;} Value)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could someone please provide some guidance.&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Are the data types not handled as I'm expecting?&lt;/LI&gt;
&lt;LI&gt;I've tried changing the double quotation marks to single apostrophes marks and doubling the apostrophes within the set analysis expression, but that returned nothing.&lt;/LI&gt;
&lt;LI&gt;Is there any way to enter an expression on both sides of a set expression? i.e. {&amp;lt;Text([Reporting YYYYMM] = {"=...&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Thu, 02 Mar 2023 03:22:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Variable-within-Expression-within-Set-Analysis/m-p/2044190#M85930</guid>
      <dc:creator>gaber</dc:creator>
      <dc:date>2023-03-02T03:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: Variable within Expression within Set Analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Variable-within-Expression-within-Set-Analysis/m-p/2044244#M85931</link>
      <description>&lt;P&gt;Are the first two set expression working perfectly, individually?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 06:43:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Variable-within-Expression-within-Set-Analysis/m-p/2044244#M85931</guid>
      <dc:creator>Gabbar</dc:creator>
      <dc:date>2023-03-02T06:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: Variable within Expression within Set Analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Variable-within-Expression-within-Set-Analysis/m-p/2044260#M85932</link>
      <description>&lt;P&gt;If I'm not mistaken I believe you need to add a dollar sign expansion:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sum({&amp;lt;[Reporting YYYYMM] = {"$(=Date(Date#('$(vEndOfReportingMonth)', 'MMM YYYY'),'YYYYMM'))"}&amp;gt;} Value)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 06:58:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Variable-within-Expression-within-Set-Analysis/m-p/2044260#M85932</guid>
      <dc:creator>henrikalmen</dc:creator>
      <dc:date>2023-03-02T06:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: Variable within Expression within Set Analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Variable-within-Expression-within-Set-Analysis/m-p/2044273#M85935</link>
      <description>&lt;P&gt;Ohh, I was so close - this fixed it!&lt;/P&gt;
&lt;P&gt;Thank you, henrikalmen.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 07:20:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Variable-within-Expression-within-Set-Analysis/m-p/2044273#M85935</guid>
      <dc:creator>gaber</dc:creator>
      <dc:date>2023-03-02T07:20:19Z</dc:date>
    </item>
  </channel>
</rss>

