<?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: AddMonths problem in Set Analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/AddMonths-problem-in-Set-Analysis/m-p/50353#M788884</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I´ve tried with num fields, but i get the same answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I attach a test document where you can see the problem. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want the sum of sales for 3 months based on the Start Date Campaign.&lt;/P&gt;&lt;P&gt;For ID 1 the correct answer is 50.000. I only get this number if i use the exact date on the Set Analysis Formula.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Feb 2018 08:09:43 GMT</pubDate>
    <dc:creator>nachofernandez</dc:creator>
    <dc:date>2018-02-06T08:09:43Z</dc:date>
    <item>
      <title>AddMonths problem in Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/AddMonths-problem-in-Set-Analysis/m-p/50345#M788876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i´m experiencing some problems related to the use of this function with set analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My requeriment is to calculate the sum of sales in a three month period of time based in the Start Date of a Campaign.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have this data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 240px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" width="80"&gt;id&lt;/TD&gt;&lt;TD class="xl63" width="80"&gt;SalesDate&lt;/TD&gt;&lt;TD class="xl63" width="80"&gt;Sales&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="17"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;20180101&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="17"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;20180201&lt;/TD&gt;&lt;TD align="right"&gt;10.000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="17"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;20180301&lt;/TD&gt;&lt;TD align="right"&gt;40.000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="17"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;20180401&lt;/TD&gt;&lt;TD align="right"&gt;50.000&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, the result for Id=1 should be 50.000 when selecting 20180101&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But i can´t get this value. My attempts are:&lt;/P&gt;&lt;P&gt;- sum({$&amp;lt;SalesDate={"&amp;gt;&lt;SPAN style="font-size: 13.3333px;"&gt;=$(=20180101)&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;lt;=$(=20180301)&lt;/SPAN&gt;"}&amp;gt;}Sales)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;This goes ok. Result=50.000&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;- sum({$&amp;lt;SalesDate={"&amp;gt;=$(=Date(Start_Date))&amp;lt;=$(=20180301)"}&amp;gt;}Sales)----&amp;gt;Start_Date=20180101 in this case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;This goes ok. Result=50.000&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- &lt;SPAN style="font-size: 13.3333px;"&gt;sum({$&amp;lt;SalesDate={"&amp;gt;=$(Date(&lt;SPAN style="font-size: 13.3333px;"&gt;Start_Date&lt;/SPAN&gt;))&amp;lt;=$(AddMonths(Date(&lt;SPAN style="font-size: 13.3333px;"&gt;Start_Date&lt;/SPAN&gt;),2))"}&amp;gt;}Sales)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---&amp;gt;&lt;SPAN style="font-size: 13.3333px;"&gt;AddMonths(Date(Start_Date),2)=20180301 in this case.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;This goes wrong. Result=100.000&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;It seems AddMonths function is not working. Any idea would be appreciated. &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/AddMonths-problem-in-Set-Analysis/m-p/50345#M788876</guid>
      <dc:creator>nachofernandez</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: AddMonths problem in Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/AddMonths-problem-in-Set-Analysis/m-p/50346#M788877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nacho,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333px;"&gt;sum({$&amp;lt;SalesDate={"&amp;gt;=$(=Date(&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Start_Date&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333px;"&gt;))&amp;lt;=$(=AddMonths(Date(&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Start_Date&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333px;"&gt;),2))"}&amp;gt;}Sales)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Feb 2018 07:44:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/AddMonths-problem-in-Set-Analysis/m-p/50346#M788877</guid>
      <dc:creator>tamilarasu</dc:creator>
      <dc:date>2018-02-05T07:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: AddMonths problem in Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/AddMonths-problem-in-Set-Analysis/m-p/50347#M788878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but I´m afraid it doesn´t work either.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result with that expression is 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if i change &lt;SPAN style="font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;AddMonths(Date(&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Start_Date&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;),2) with 20180301 it goes perfect. Something´s wrong with AddMonths.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Feb 2018 08:03:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/AddMonths-problem-in-Set-Analysis/m-p/50347#M788878</guid>
      <dc:creator>nachofernandez</dc:creator>
      <dc:date>2018-02-05T08:03:37Z</dc:date>
    </item>
    <item>
      <title>Re: AddMonths problem in Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/AddMonths-problem-in-Set-Analysis/m-p/50348#M788879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;Got it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;sum({$&amp;lt;SalesDate={"&amp;gt;=$(=Date(Start_Date))&amp;lt;=$(=Date(AddMonths(Date#(SalesDate,'YYYYMMDD'),2),'YYYYMMDD') )"}&amp;gt;}Sales)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;If your SalesDate field is already formatted as date format means you can simply try,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;sum({$&amp;lt;SalesDate={"&amp;gt;=$(=Date(Start_Date))&amp;lt;=$(=Date(AddMonths(SalesDate,2),'YYYYMMDD') )"}&amp;gt;}Sales)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Feb 2018 08:10:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/AddMonths-problem-in-Set-Analysis/m-p/50348#M788879</guid>
      <dc:creator>tamilarasu</dc:creator>
      <dc:date>2018-02-05T08:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: AddMonths problem in Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/AddMonths-problem-in-Set-Analysis/m-p/50349#M788880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, sorry,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;None of them work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Feb 2018 08:46:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/AddMonths-problem-in-Set-Analysis/m-p/50349#M788880</guid>
      <dc:creator>nachofernandez</dc:creator>
      <dc:date>2018-02-05T08:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: AddMonths problem in Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/AddMonths-problem-in-Set-Analysis/m-p/50350#M788881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are other approaches you can take if your struggling with this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(1) Add a field in the load script that highlights it as part of that 3 month group.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(2) Another simpler approach might be to try the RangeAvg function&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.qlik.com/en-US/qlikview/November2017/Subsystems/Client/Content/ChartFunctions/RangeFunctions/rangeavg.htm" title="http://help.qlik.com/en-US/qlikview/November2017/Subsystems/Client/Content/ChartFunctions/RangeFunctions/rangeavg.htm"&gt;RangeAvg - script and chart function ‒ QlikView&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use this directly in your expressions&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Feb 2018 09:00:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/AddMonths-problem-in-Set-Analysis/m-p/50350#M788881</guid>
      <dc:creator>ruanhaese</dc:creator>
      <dc:date>2018-02-05T09:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: AddMonths problem in Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/AddMonths-problem-in-Set-Analysis/m-p/50351#M788882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not sure but it's working for me. &lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/192485_Capture.PNG" style="height: 183px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;Try removing the label and see how expression is evaluated. If you still have any issues, please upload a small sample file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Feb 2018 09:17:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/AddMonths-problem-in-Set-Analysis/m-p/50351#M788882</guid>
      <dc:creator>tamilarasu</dc:creator>
      <dc:date>2018-02-05T09:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: AddMonths problem in Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/AddMonths-problem-in-Set-Analysis/m-p/50352#M788883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello &lt;A href="https://community.qlik.com/qlik-users/139951"&gt;nachofernandez&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Whenever I try to do set analysis with dates, I always convert them to numerical values first. As we are performing logical operations (&amp;gt;= &amp;lt;=), it is best to work with integers rather than date formats that may cause you some nightmares.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Find below my notes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Script:&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_1517823970682854" jivemacro_uid="_1517823970682854"&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;LOAD * INLINE [&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; id, SalesDate,&amp;nbsp; SalesDateNum, Sales&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; 1,&amp;nbsp; 01/01/2018, 43101,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; 1,&amp;nbsp; &lt;SPAN style="color: rgba(0, 0, 0, 0); font-family: Consolas, 'Courier New', Courier, mono, serif;"&gt;01/01/2018, &lt;/SPAN&gt;43132,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10000&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; 1,&amp;nbsp; &lt;SPAN style="color: rgba(0, 0, 0, 0); font-family: Consolas, 'Courier New', Courier, mono, serif;"&gt;01/01/2018, &lt;/SPAN&gt;43160,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 40000&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; 1,&amp;nbsp; &lt;SPAN style="color: rgba(0, 0, 0, 0); font-family: Consolas, 'Courier New', Courier, mono, serif;"&gt;01/01/2018, &lt;/SPAN&gt;43191,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 50000&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;];&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Let Start_Date = Num(Date(MakeDate(2018, 1, 1)))&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Let End_Date&amp;nbsp; = Num(AddMonths($(Start_Date), 2))&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;









&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set Analysis (see the flow):&lt;/P&gt;&lt;P&gt;SUM( {&amp;lt;[SalesDateNum]={"&amp;gt;= 43101 &amp;lt;= 43160"}&amp;gt;} [Sales])&amp;nbsp; --&amp;gt; &lt;STRONG&gt;50k&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;SUM( {&amp;lt;[SalesDateNum]={"&amp;gt;= 43101 &amp;lt;= $(End_Date)"}&amp;gt;} [Sales])--&amp;gt; &lt;STRONG&gt;50k&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;SUM( {&amp;lt;[SalesDateNum]={"&amp;gt;= 43101 &amp;lt;= $(=Num(AddMonths($(Start_Date), 2)))"}&amp;gt;} [Sales])&amp;nbsp; --&amp;gt; &lt;STRONG&gt;50k &lt;/STRONG&gt;(Notce $=(..) )&lt;/P&gt;&lt;P&gt;SUM( {&amp;lt;[SalesDateNum]={"&amp;gt;= 43101 &amp;lt;=&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Num(AddMonths($(Start_Date), 2)))"}&amp;gt;} [Sales])&amp;nbsp; --&amp;gt; &lt;STRONG&gt;100k&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Most probable, your error was due to the $(= ..) variable inside your SalesDate expression:&lt;/P&gt;&lt;P&gt;Not working: Sum({$&amp;lt;SalesDate={"&amp;gt;=$(Date(Start_Date))&amp;lt;= &lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;$(AddMonths&lt;/STRONG&gt;&lt;/SPAN&gt;(Date(Start_Date),2))"}&amp;gt;}Sales)&lt;/P&gt;&lt;P&gt;Working:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum({&amp;lt;[SalesDateNum]={"&amp;gt;= 43101 &amp;lt;= &lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;$(=Num(AddMonths&lt;/STRONG&gt;&lt;/SPAN&gt;($(Start_Date), 2)))"}&amp;gt;} [Sales])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could replicate these numbers using your SalesDate in date format. But be aware that even though you type in 20180101, this may not be a numerical value but a date value. To prevent such discrepancies, I highly recommend you to use numerical values always.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Saludos,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Feb 2018 09:56:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/AddMonths-problem-in-Set-Analysis/m-p/50352#M788883</guid>
      <dc:creator>jasonmomoa</dc:creator>
      <dc:date>2018-02-05T09:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: AddMonths problem in Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/AddMonths-problem-in-Set-Analysis/m-p/50353#M788884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I´ve tried with num fields, but i get the same answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I attach a test document where you can see the problem. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want the sum of sales for 3 months based on the Start Date Campaign.&lt;/P&gt;&lt;P&gt;For ID 1 the correct answer is 50.000. I only get this number if i use the exact date on the Set Analysis Formula.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Feb 2018 08:09:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/AddMonths-problem-in-Set-Analysis/m-p/50353#M788884</guid>
      <dc:creator>nachofernandez</dc:creator>
      <dc:date>2018-02-06T08:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: AddMonths problem in Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/AddMonths-problem-in-Set-Analysis/m-p/50354#M788885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In your test here, the Date_ID from your Sales inline table is not related to the Date_ID_num from your Calendar table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can create a simple table box with fields Date_ID, Date_ID_Num, ID and Sales. You'll see there is no relationship. Therefore, your last expression test using Num() dates in the set analysis won't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try creating the very first input table with Dates(), rather than just typing the id in YYYYMMDD format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Feb 2018 09:21:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/AddMonths-problem-in-Set-Analysis/m-p/50354#M788885</guid>
      <dc:creator>jasonmomoa</dc:creator>
      <dc:date>2018-02-06T09:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: AddMonths problem in Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/AddMonths-problem-in-Set-Analysis/m-p/50355#M788886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Almost got it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I´ve changed the scritp and now they´re connected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If i select ID 1 it works. If i don´t select anything, the result is 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need the table complete, without selecting anything.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Feb 2018 18:22:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/AddMonths-problem-in-Set-Analysis/m-p/50355#M788886</guid>
      <dc:creator>nachofernandez</dc:creator>
      <dc:date>2018-02-06T18:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: AddMonths problem in Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/AddMonths-problem-in-Set-Analysis/m-p/50356#M788887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I´ve found the solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems Set Analysis is not applicable to this situation. Just if a record or a date is selected, but with no selection it doesn´t work. Changing it for an if function, it works very well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for all the answers. They helped me a lot.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Feb 2018 07:08:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/AddMonths-problem-in-Set-Analysis/m-p/50356#M788887</guid>
      <dc:creator>nachofernandez</dc:creator>
      <dc:date>2018-02-07T07:08:54Z</dc:date>
    </item>
  </channel>
</rss>

