<?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: Date Variables in Set Analysis in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Date-Variables-in-Set-Analysis/m-p/1771130#M59683</link>
    <description>&lt;P&gt;I guess quotes are playing evil here. Try removing the single quotes from the &lt;EM&gt;ThisMonth&amp;nbsp;&lt;/EM&gt;variable definition.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Dec 2020 05:34:28 GMT</pubDate>
    <dc:creator>tresB</dc:creator>
    <dc:date>2020-12-30T05:34:28Z</dc:date>
    <item>
      <title>Date Variables in Set Analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Date-Variables-in-Set-Analysis/m-p/1771114#M59681</link>
      <description>&lt;P&gt;Hello Qlik Community,&lt;/P&gt;&lt;P&gt;Utterly stumped with an issue today using variables in set analysis, particularly those around dates&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;I have two variables, one that establishes the most recent month in my data set, and another that establishes the previous quarter. The second one makes use of the first.&lt;/P&gt;&lt;P&gt;let ThisMonth = 'date(Max(TOTAL date([Service Date])),"MMM-YYYY")';&lt;/P&gt;&lt;P&gt;let CurrentQuarter = '&amp;gt;=$(=MonthStart($(ThisMonth),-2))&amp;lt;=$(=Date(Floor(MonthEnd($(ThisMonth),-0))))';&lt;/P&gt;&lt;P&gt;What I would like to do is sum cost for the latest quarter like so:&lt;/P&gt;&lt;P&gt;=sum({&amp;lt;[Service Date]={"$(=Date($(CurrentQuarter)))"}&amp;gt;}[Cost])&lt;/P&gt;&lt;P&gt;I cannot get it to work though. I've tried many approaches that I have come across in the community, but none seem to work for me.&lt;/P&gt;&lt;P&gt;Interestingly, the following works perfectly fine:&lt;/P&gt;&lt;P&gt;=sum({&amp;lt;[Service Date]={"&amp;gt;=$(=MonthStart($(ThisMonth),-2))&amp;lt;=$(=Date(Floor(MonthEnd($(ThisMonth),-0))))"}&amp;gt;}[Cost])&lt;/P&gt;&lt;P&gt;I'm beginning to wonder if the variable being utilized within the other variable has something to do with why it's not working for me -- however, when I replace the $(ThisMonth) variable with its expression, it does not work for me either.&lt;/P&gt;&lt;P&gt;Any insight here would be awesome.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Dec 2020 20:11:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Date-Variables-in-Set-Analysis/m-p/1771114#M59681</guid>
      <dc:creator>sgagliardi</dc:creator>
      <dc:date>2020-12-29T20:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: Date Variables in Set Analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Date-Variables-in-Set-Analysis/m-p/1771130#M59683</link>
      <description>&lt;P&gt;I guess quotes are playing evil here. Try removing the single quotes from the &lt;EM&gt;ThisMonth&amp;nbsp;&lt;/EM&gt;variable definition.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2020 05:34:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Date-Variables-in-Set-Analysis/m-p/1771130#M59683</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2020-12-30T05:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: Date Variables in Set Analysis</title>
      <link>https://community.qlik.com/t5/App-Development/Date-Variables-in-Set-Analysis/m-p/1771210#M59685</link>
      <description>&lt;P&gt;It didn't work because your nested variables contain commas which will be always treated as parameter-delimiter. AFAIK there is no way to mask them or to bypass this behaviour unless you could ensure with a different logic/syntax that there no commas included.&lt;/P&gt;&lt;P&gt;Beside this it's not recommended to use nested variables because of the complexity of the matter - not only the comma-issue else also in regard to the various kinds of quotes, comments, $-sign expansions and probably some more reasons.&lt;/P&gt;&lt;P&gt;Even the creating of those variables itself is&amp;nbsp;questionable because variables should simplify things which they don't in this case. I suggest to avoid them and using an appropriate field from the datamodel, maybe like:&lt;/P&gt;&lt;P&gt;year(DATE) * 12 + month(DATE) as RunningPeriod&lt;/P&gt;&lt;P&gt;and then querying the max. value within the set analysis +- n Periods for those periods you want to display.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2020 14:36:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Date-Variables-in-Set-Analysis/m-p/1771210#M59685</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2020-12-30T14:36:54Z</dc:date>
    </item>
  </channel>
</rss>

