<?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 Problem with a formula in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Problem-with-a-formula/m-p/200121#M58784</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh! Of course! MonthYear is a date. So 1+max(MonthYear)-min(MonthYear) is giving the DAYS between the two, not the MONTHS.&lt;/P&gt;&lt;P&gt;Hopefully you can debug from there. Very busy right now. Will debug later if you haven't.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 31 Mar 2010 20:25:21 GMT</pubDate>
    <dc:creator>johnw</dc:creator>
    <dc:date>2010-03-31T20:25:21Z</dc:date>
    <item>
      <title>Problem with a formula</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-a-formula/m-p/200115#M58778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone:&lt;/P&gt;&lt;P&gt;I'm using this formula in set analysis to calculate the sales of my previous selected month:&lt;/P&gt;&lt;P&gt;SUM({$&amp;lt;Year= {$(=max(Year) - $(=if(max(Month) = 1, 1, 0)))},Month = {$(=if((Month) = 1, 12, only(Month)-1) )}, MonthYear = {"&amp;lt;=$(=max(MonthYear))"}&amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;Does anyone can help me to modify this formula´, i need to show the sales of "N" Previous Months, because mine it only works when you select 1 month???&lt;/P&gt;&lt;P&gt;For example, if I select DEC,NOV,OCT of 2009, the formula has to show JUL,AUG,SEP of 2009&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Carlos&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Mar 2010 17:18:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-a-formula/m-p/200115#M58778</guid>
      <dc:creator />
      <dc:date>2010-03-31T17:18:27Z</dc:date>
    </item>
    <item>
      <title>Problem with a formula</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-a-formula/m-p/200116#M58779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe this?&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;sum({&amp;lt;Year=,Month=,MonthYear={"&amp;lt;$(=min(MonthYear)) &amp;gt;=$(=addmonths(min(MonthYear),1+max(MonthYear)-min(MonthYear)))"}&amp;gt;} Sales)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Mar 2010 18:35:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-a-formula/m-p/200116#M58779</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-03-31T18:35:40Z</dc:date>
    </item>
    <item>
      <title>Problem with a formula</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-a-formula/m-p/200117#M58780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Almost John, with that formula you can get the sales up to the previous month of the selection, what i attempt to do is to get the sales for the same number of the month's selection but the previous one, may i make myself understable???&lt;/P&gt;&lt;P&gt;Example :&lt;/P&gt;&lt;P&gt;My Selection = JAN 2010, FEB 2010&lt;/P&gt;&lt;P&gt;Desire Column = NOV 2009, DEC 2009&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Carlos&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Mar 2010 18:58:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-a-formula/m-p/200117#M58780</guid>
      <dc:creator />
      <dc:date>2010-03-31T18:58:56Z</dc:date>
    </item>
    <item>
      <title>Problem with a formula</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-a-formula/m-p/200118#M58781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The formula I posted is intended to do that. Note this portion of it:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;sum({&amp;lt;Year=,Month=,MonthYear={"&amp;lt;$(=min(MonthYear)) &lt;STRONG&gt;&amp;gt;=$(=addmonths(min(MonthYear),1+max(MonthYear)-min(MonthYear)))&lt;/STRONG&gt;"}&amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;1+max(MonthYear)-min(MonthYear) is calculating how many months are in the range you selected. We then subtract that many months from min(MonthYear). That gives us the starting point for the range.&lt;/P&gt;&lt;P&gt;Is it not working? It might have a bug in it, since I can't test it myself. I would suggest breaking down the part I highlighted above, and trying to figure out where it is going wrong.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Mar 2010 19:10:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-a-formula/m-p/200118#M58781</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-03-31T19:10:47Z</dc:date>
    </item>
    <item>
      <title>Problem with a formula</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-a-formula/m-p/200119#M58782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I understand the point i will try this part and i tell you later, thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Carlos&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Mar 2010 19:17:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-a-formula/m-p/200119#M58782</guid>
      <dc:creator />
      <dc:date>2010-03-31T19:17:58Z</dc:date>
    </item>
    <item>
      <title>Problem with a formula</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-a-formula/m-p/200120#M58783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think here is the problem John but i dont get why the year goes to 2012, look i put this part of the formula in a chart to see the results and look:&lt;/P&gt;&lt;P&gt;&lt;A href="http://community.qlik.com/cfs-file.ashx/__key/CommunityServer.Discussions.Components.Files/11/2273.Sin-t_ED00_tulo.png"&gt;&lt;IMG alt="" border="0" src="http://community.qlik.com/resized-image.ashx/__size/550x0/__key/CommunityServer.Discussions.Components.Files/11/2273.Sin-t_ED00_tulo.png" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any ideas???&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Mar 2010 20:16:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-a-formula/m-p/200120#M58783</guid>
      <dc:creator />
      <dc:date>2010-03-31T20:16:51Z</dc:date>
    </item>
    <item>
      <title>Problem with a formula</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-a-formula/m-p/200121#M58784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh! Of course! MonthYear is a date. So 1+max(MonthYear)-min(MonthYear) is giving the DAYS between the two, not the MONTHS.&lt;/P&gt;&lt;P&gt;Hopefully you can debug from there. Very busy right now. Will debug later if you haven't.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Mar 2010 20:25:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-a-formula/m-p/200121#M58784</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-03-31T20:25:21Z</dc:date>
    </item>
    <item>
      <title>Problem with a formula</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-a-formula/m-p/200122#M58785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I will appreciate if you can help with this when you have time plz John, its very important this plz&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Carlos&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Mar 2010 23:45:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-a-formula/m-p/200122#M58785</guid>
      <dc:creator />
      <dc:date>2010-03-31T23:45:43Z</dc:date>
    </item>
    <item>
      <title>Problem with a formula</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-a-formula/m-p/200123#M58786</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about this?&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;sum({&amp;lt;Year=,Month=,MonthYear={"&amp;lt;$(=min(MonthYear)) &amp;gt;=$(=addmonths(min(MonthYear),&lt;STRONG&gt;-count(distinct MonthYear)&lt;/STRONG&gt;))"}&amp;gt;} Sales)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Mar 2010 23:56:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-a-formula/m-p/200123#M58786</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-03-31T23:56:47Z</dc:date>
    </item>
    <item>
      <title>Problem with a formula</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-a-formula/m-p/200124#M58787</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is the same result of the other formula, it doesnt work, i put this:&lt;/P&gt;&lt;P&gt;addmonths(min(MonthYear),-GetSelectedCount(MonthYear))&lt;/P&gt;&lt;P&gt;and i can get the desire period of time but the formula doesnt work, i mean when i select JAN 2010, FEB 2010 i get DIC 2009, NOV 2009&lt;/P&gt;&lt;P&gt;but without the sum of the sales.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Apr 2010 00:07:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-a-formula/m-p/200124#M58787</guid>
      <dc:creator />
      <dc:date>2010-04-01T00:07:43Z</dc:date>
    </item>
    <item>
      <title>Problem with a formula</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-a-formula/m-p/200125#M58788</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, all it needs is for the date to be correctly formatted to match your MonthYear. In the attached example, that means putting it in MMM YYYY format. If that's the format you're using, use this:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;sum({&amp;lt;Year=,Month=,MonthYear={"&amp;lt;$(=min(MonthYear)) &amp;gt;=$(=date(addmonths(min(MonthYear),-count(distinct MonthYear)),'MMM YYYY'))"}&amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;Otherwise substitute your own format.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Apr 2010 16:23:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-a-formula/m-p/200125#M58788</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-04-01T16:23:11Z</dc:date>
    </item>
    <item>
      <title>Problem with a formula</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-a-formula/m-p/200126#M58789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John:&lt;/P&gt;&lt;P&gt;It works perfect, thanks for all your support.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Carlos&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Apr 2010 16:58:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-a-formula/m-p/200126#M58789</guid>
      <dc:creator />
      <dc:date>2010-04-05T16:58:51Z</dc:date>
    </item>
  </channel>
</rss>

