<?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 Math within set analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Math-within-set-analysis/m-p/221719#M74514</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;you can use formulas within set analysis, using the $ expansion mechanism.&lt;/P&gt;&lt;P&gt;sum ({$&amp;lt;RollingMonth={$(=AddMonth(Now,-12)}&amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;I didn't test the formula, so there might be slight typos ... but you see the principle.&lt;/P&gt;&lt;P&gt;You might replace Now by another expansion with your selection.&lt;/P&gt;&lt;P&gt;hth,&lt;BR /&gt;Thilo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 25 Jan 2010 19:32:28 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-01-25T19:32:28Z</dc:date>
    <item>
      <title>Math within set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Math-within-set-analysis/m-p/221718#M74513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am having issues with using math within set analysis . More specifically, I am specifying a month in a list box and would like to calc , for example sake sum(sales), for the month specified and divide it by the same calc for twelve months earlier . This would make a year over year comparison of the calculation.&lt;/P&gt;&lt;P&gt;Currently, I am simply hard coding the month. I have selected Dec 09 in the list box and use the following expression.&lt;/P&gt;&lt;P&gt;Sum(Sales)/Sum({$&amp;lt;RollingMonth={"12/08"}&amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;Is there a way to subtract twelve months within the set analysis , so I am able to select any month, and compare it to that month the year before?&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jan 2010 19:09:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Math-within-set-analysis/m-p/221718#M74513</guid>
      <dc:creator />
      <dc:date>2010-01-25T19:09:35Z</dc:date>
    </item>
    <item>
      <title>Math within set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Math-within-set-analysis/m-p/221719#M74514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;you can use formulas within set analysis, using the $ expansion mechanism.&lt;/P&gt;&lt;P&gt;sum ({$&amp;lt;RollingMonth={$(=AddMonth(Now,-12)}&amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;I didn't test the formula, so there might be slight typos ... but you see the principle.&lt;/P&gt;&lt;P&gt;You might replace Now by another expansion with your selection.&lt;/P&gt;&lt;P&gt;hth,&lt;BR /&gt;Thilo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jan 2010 19:32:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Math-within-set-analysis/m-p/221719#M74514</guid>
      <dc:creator />
      <dc:date>2010-01-25T19:32:28Z</dc:date>
    </item>
    <item>
      <title>Math within set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Math-within-set-analysis/m-p/221720#M74515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You are going to need to be careful here.&lt;/P&gt;&lt;P&gt;I am guessing that your "RollingMonth" field was probably created (like the training course) using the Date(date_field, 'MM/YY') format in the script. This created a Dual value (has both numeric [date] and text value).&lt;/P&gt;&lt;P&gt;This is all well and good if you start to use an expression like:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum({&amp;lt;RollingMonth = {"$(=Max(RollingMonth))"}&amp;gt;} Amount)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;(if you want to stop hard coding)&lt;/P&gt;&lt;P&gt;Then you might think to use an AddMonths to compare your date 12 months ago like this:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum({&amp;lt;RollingMonth = {"$(=AddMonths(Max(RollingMonth),-12))"}&amp;gt;} Amount)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;The problem is that the AddMonths function will leave you with only a date - not a Dual value. This set will not work!&lt;/P&gt;&lt;P&gt;To make it work, you need to make it a Dual again using the Date function:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum({&amp;lt;RollingMonth = {"$(=Date(AddMonths(Max(RollingMonth),-12),'MM/YY'))"}&amp;gt;} Amount)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stephen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jan 2010 19:39:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Math-within-set-analysis/m-p/221720#M74515</guid>
      <dc:creator>stephencredmond</dc:creator>
      <dc:date>2010-01-25T19:39:14Z</dc:date>
    </item>
    <item>
      <title>Math within set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Math-within-set-analysis/m-p/221721#M74516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This thread has inspired a blog post: &lt;A href="http://qliktips.blogspot.com/2010/01/more-on-dual-problem-in-sets.html"&gt;http://qliktips.blogspot.com/2010/01/more-on-dual-problem-in-sets.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stephen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jan 2010 20:00:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Math-within-set-analysis/m-p/221721#M74516</guid>
      <dc:creator>stephencredmond</dc:creator>
      <dc:date>2010-01-25T20:00:21Z</dc:date>
    </item>
    <item>
      <title>Math within set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Math-within-set-analysis/m-p/221722#M74517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Stephen,&lt;/P&gt;&lt;P&gt;For me, the following code is not working as you described:&lt;/P&gt;&lt;P style="font-weight: bold"&gt;Sum({&amp;lt;RollingMonth = {"$(=Max(RollingMonth))"}&amp;gt;} Amount)&lt;/P&gt;&lt;P&gt;If RollingMonth is a dual, the Max() function is returning an integer, and the set is apparently interpreting RollingMonth as a String. I've tried it with the double quotes (which is not documented in the QV help).&lt;/P&gt;&lt;P&gt;However, I could get the result I want by Using the function MaxString() in stead of Max():&lt;/P&gt;&lt;P style="font-weight: bold"&gt;Sum({&amp;lt;RollingMonth = {$(=MaxString(RollingMonth))}&amp;gt;} Amount)&lt;/P&gt;&lt;P&gt;The above code did bring the required result. I've tested it with both QV9R2 and QV9R4. I wouldn't be surprised if older versions had different behaviour. I'm very curious to know with which version you have tested it!&lt;/P&gt;&lt;P&gt;Kind regards.&lt;/P&gt;&lt;P&gt;Daniël&lt;B&gt;&lt;BR /&gt;&lt;/B&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 May 2010 15:17:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Math-within-set-analysis/m-p/221722#M74517</guid>
      <dc:creator />
      <dc:date>2010-05-16T15:17:00Z</dc:date>
    </item>
  </channel>
</rss>

