<?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 - Comparison with variable in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Set-analysis-Comparison-with-variable/m-p/1759836#M58744</link>
    <description>&lt;P&gt;I found that the correct formula is:&lt;BR /&gt;Sum ({$ &amp;lt;[Order Date.autoCalendar.MonthsAgo] = {1}&amp;gt;} [Sales])&lt;/P&gt;&lt;P&gt;But I would still love to understand why the previous formula does not work.&lt;/P&gt;</description>
    <pubDate>Mon, 09 Nov 2020 13:03:52 GMT</pubDate>
    <dc:creator>Shoro</dc:creator>
    <dc:date>2020-11-09T13:03:52Z</dc:date>
    <item>
      <title>Set analysis - Comparison with variable</title>
      <link>https://community.qlik.com/t5/App-Development/Set-analysis-Comparison-with-variable/m-p/1759816#M58742</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;I want to get the last month's Sum of sales.&lt;/P&gt;&lt;P&gt;I use a variable called vLastMonth:&lt;BR /&gt;= Text (Year (Today ())) &amp;amp; '-' &amp;amp; Month (AddMonths (Today (), - 1))&lt;/P&gt;&lt;P&gt;And this is the formula to get the Sum of last month's sales:&lt;/P&gt;&lt;P&gt;Sum ({$ &amp;lt;[Order Date.autoCalendar.YearMonth] = {"vLastMonth"}&amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;But the result is: 0.&lt;BR /&gt;Why?&lt;/P&gt;&lt;P&gt;If I put "2020-Oct" it works.&lt;/P&gt;&lt;P&gt;Why does working with the variable fail?&lt;/P&gt;&lt;P&gt;I would also love to understand, why if I add $ to a variable&lt;BR /&gt;Sum ({$ &amp;lt;[Order Date.autoCalendar.YearMonth] = $ {"vLastMonth"}&amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;I get the Sum of all sales without filtering of months (last month).&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 12:42:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-analysis-Comparison-with-variable/m-p/1759816#M58742</guid>
      <dc:creator>Shoro</dc:creator>
      <dc:date>2020-11-09T12:42:25Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis - Comparison with variable</title>
      <link>https://community.qlik.com/t5/App-Development/Set-analysis-Comparison-with-variable/m-p/1759829#M58743</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/129279"&gt;@Shoro&lt;/a&gt;&amp;nbsp; you can try this :&lt;/P&gt;&lt;LI-CODE lang="python"&gt;=Sum ({$ &amp;lt;[Order Date.autoCalendar.YearMonth] = { '$(vLastMonth)' }&amp;gt;} Sales)
&lt;/LI-CODE&gt;&lt;P&gt;and check date format for Order Date.autoCalendar.YearMonth must be YYYY-MMM&lt;/P&gt;&lt;P&gt;and example :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 403px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/43814i7AFB3CCEB34A1152/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 12:45:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-analysis-Comparison-with-variable/m-p/1759829#M58743</guid>
      <dc:creator>Taoufiq_Zarra</dc:creator>
      <dc:date>2020-11-09T12:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis - Comparison with variable</title>
      <link>https://community.qlik.com/t5/App-Development/Set-analysis-Comparison-with-variable/m-p/1759836#M58744</link>
      <description>&lt;P&gt;I found that the correct formula is:&lt;BR /&gt;Sum ({$ &amp;lt;[Order Date.autoCalendar.MonthsAgo] = {1}&amp;gt;} [Sales])&lt;/P&gt;&lt;P&gt;But I would still love to understand why the previous formula does not work.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 13:03:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-analysis-Comparison-with-variable/m-p/1759836#M58744</guid>
      <dc:creator>Shoro</dc:creator>
      <dc:date>2020-11-09T13:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis - Comparison with variable</title>
      <link>https://community.qlik.com/t5/App-Development/Set-analysis-Comparison-with-variable/m-p/1759864#M58745</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/129279"&gt;@Shoro&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think the reason why this&amp;nbsp;&lt;SPAN&gt;Sum ({$ &amp;lt;[Order Date.autoCalendar.YearMonth] = $ {"vLastMonth"}&amp;gt;} Sales) didn't work is because you put the double quote and the dollar expansion ($) in the wrong place. See below&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Sum ({$ &amp;lt;[Order Date.autoCalendar.YearMonth] =&amp;nbsp; {"$(vLastMonth)"}&amp;gt;} Sales)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Hopefully this helps&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 14:02:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-analysis-Comparison-with-variable/m-p/1759864#M58745</guid>
      <dc:creator>Gabriel</dc:creator>
      <dc:date>2020-11-09T14:02:52Z</dc:date>
    </item>
  </channel>
</rss>

