<?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 Trouble with dates and current selections in set expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Trouble-with-dates-and-current-selections-in-set-expression/m-p/1796#M511756</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I read about 20 articles about previous periods before posting this, as this seems to be a really simple problem someone will know how to solve.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I can't post data, sorry, as I work in Health and our data is not de-identified and uses a data store.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, I am trying to create a simple table showing the sum of something for this month, compared to last month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My vMaxDate is 31/12/2017 at this stage.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using a straight table, I can get all the data to display for Nov2017 using the below. (I realise there are more elegant ways of doing this with flags, something I'll get to eventually.) I realise I may have some redundant syntax - be gentle, I am still learning.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum({$&amp;lt;Date = {"&amp;gt;=$(=monthstart(addmonths($(=vMaxDate),-1)))&amp;lt;=$(=monthend(addmonths($(=vMaxDate),-1)))"}, Day=&amp;gt;} DS_Complete_Counter)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can also display the current month using:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum({$&amp;lt;Date = {"&amp;gt;=$(=monthstart($(vMaxDate)))&amp;lt;=($(vMaxDate))"}&amp;gt;, Day=} DS_Complete_Counter)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, if I select a date, let's say Jun 3rd, 2017, I want the table to do 2 things.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Previous month to show May and current month June.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, when I choose that date, both cols in the table are blank, so it looks like the current selection isn't working?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Date is not a num, I have DateNum for that, and not stored as a dual.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Happy to share Cal or anything else (I am using the standard MasterCal).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry to ask such a simple question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Jan 2018 01:58:45 GMT</pubDate>
    <dc:creator>timmarsh</dc:creator>
    <dc:date>2018-01-17T01:58:45Z</dc:date>
    <item>
      <title>Trouble with dates and current selections in set expression</title>
      <link>https://community.qlik.com/t5/QlikView/Trouble-with-dates-and-current-selections-in-set-expression/m-p/1796#M511756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I read about 20 articles about previous periods before posting this, as this seems to be a really simple problem someone will know how to solve.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I can't post data, sorry, as I work in Health and our data is not de-identified and uses a data store.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, I am trying to create a simple table showing the sum of something for this month, compared to last month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My vMaxDate is 31/12/2017 at this stage.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using a straight table, I can get all the data to display for Nov2017 using the below. (I realise there are more elegant ways of doing this with flags, something I'll get to eventually.) I realise I may have some redundant syntax - be gentle, I am still learning.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum({$&amp;lt;Date = {"&amp;gt;=$(=monthstart(addmonths($(=vMaxDate),-1)))&amp;lt;=$(=monthend(addmonths($(=vMaxDate),-1)))"}, Day=&amp;gt;} DS_Complete_Counter)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can also display the current month using:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum({$&amp;lt;Date = {"&amp;gt;=$(=monthstart($(vMaxDate)))&amp;lt;=($(vMaxDate))"}&amp;gt;, Day=} DS_Complete_Counter)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, if I select a date, let's say Jun 3rd, 2017, I want the table to do 2 things.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Previous month to show May and current month June.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, when I choose that date, both cols in the table are blank, so it looks like the current selection isn't working?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Date is not a num, I have DateNum for that, and not stored as a dual.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Happy to share Cal or anything else (I am using the standard MasterCal).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry to ask such a simple question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jan 2018 01:58:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Trouble-with-dates-and-current-selections-in-set-expression/m-p/1796#M511756</guid>
      <dc:creator>timmarsh</dc:creator>
      <dc:date>2018-01-17T01:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with dates and current selections in set expression</title>
      <link>https://community.qlik.com/t5/QlikView/Trouble-with-dates-and-current-selections-in-set-expression/m-p/1797#M511757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you making selection in the same &lt;STRONG&gt;Date&lt;/STRONG&gt; field as the one you have in your set analysis or is there another field that you make selection in?&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: 13px;"&gt;=sum({$&amp;lt;&lt;STRONG&gt;Date&lt;/STRONG&gt; = {"&amp;gt;=$(=monthstart($(vMaxDate)))&amp;lt;=($(vMaxDate))"}&amp;gt;, Day=} DS_Complete_Counter)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jan 2018 02:10:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Trouble-with-dates-and-current-selections-in-set-expression/m-p/1797#M511757</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-01-17T02:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with dates and current selections in set expression</title>
      <link>https://community.qlik.com/t5/QlikView/Trouble-with-dates-and-current-selections-in-set-expression/m-p/1798#M511758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah. No. vMaxDate is a variable calculated before cal formed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stupid me.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;So...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The &lt;STRONG&gt;current month&lt;/STRONG&gt; (of selection, or max record date if no selection) is expressed as below and now works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum({$&amp;lt;Date = {"&amp;gt;=$(=monthstart((Max(Date))))&amp;lt;=((Max(Date)))"}, Day=&amp;gt;} DS_Complete_Counter)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The previous month is still not working&lt;/STRONG&gt;. I am missing something simple. I tested monthstart and monthend in textboxes with and without selections and it's working fine, so I am missing something simple!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Its expression is now:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum({$&amp;lt;Date = {"&amp;gt;=$(=monthstart(addmonths(Max(Date),-1)))&amp;lt;=$(=monthend(addmonths(Max(Date),-1)))"}, Day=&amp;gt;} DS_Complete_Counter)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What am I missing?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help, Sunny.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jan 2018 03:16:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Trouble-with-dates-and-current-selections-in-set-expression/m-p/1798#M511758</guid>
      <dc:creator>timmarsh</dc:creator>
      <dc:date>2018-01-17T03:16:37Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with dates and current selections in set expression</title>
      <link>https://community.qlik.com/t5/QlikView/Trouble-with-dates-and-current-selections-in-set-expression/m-p/1799#M511759</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;Could you please try this expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum({$&amp;lt;Date = {"&amp;gt;=$(=monthstart(addmonths(Max(Date),-1)))&amp;lt;=$(=monthend(addmonths(Max(Date),-1)))"}&amp;gt;} &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;DS_Complete_Counter&lt;/SPAN&gt;).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jan 2018 06:13:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Trouble-with-dates-and-current-selections-in-set-expression/m-p/1799#M511759</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-17T06:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with dates and current selections in set expression</title>
      <link>https://community.qlik.com/t5/QlikView/Trouble-with-dates-and-current-selections-in-set-expression/m-p/1800#M511760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=Sum({$&amp;lt;Date = {"&amp;gt;=$(=MonthStart(Max(Date), -1))&amp;lt;$(=MonthStart(Max(Date), 0))"}, Day=&amp;gt;} DS_Complete_Counter)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jan 2018 09:27:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Trouble-with-dates-and-current-selections-in-set-expression/m-p/1800#M511760</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-01-17T09:27:18Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with dates and current selections in set expression</title>
      <link>https://community.qlik.com/t5/QlikView/Trouble-with-dates-and-current-selections-in-set-expression/m-p/1801#M511761</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I dont know why it is taking such a long time to moderate this.&lt;IMG alt="Qlik.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/190309_Qlik.PNG" style="height: 269px; width: 620px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jan 2018 10:11:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Trouble-with-dates-and-current-selections-in-set-expression/m-p/1801#M511761</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-17T10:11:47Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with dates and current selections in set expression</title>
      <link>https://community.qlik.com/t5/QlikView/Trouble-with-dates-and-current-selections-in-set-expression/m-p/1802#M511762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sunny,&lt;/P&gt;&lt;P&gt;Did you mean:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum({$&amp;lt;Date = {"&amp;gt;=$(=monthstart(addmonths(Max(Date),-1)))&amp;lt;=$(=monthend(addmonths(Max(Date),-1)))"}, Day=&amp;gt;} DS_Complete_Counter)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(I need to go back 1&amp;nbsp; month), also you still had the AddMonths -1 paramater in there but no add months.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to be clear, the current month is working perfectly in the state of no selections or with selections, and ignores day selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's the previous month that is not selecting any records in the select state. In default state it works fine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jan 2018 22:27:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Trouble-with-dates-and-current-selections-in-set-expression/m-p/1802#M511762</guid>
      <dc:creator>timmarsh</dc:creator>
      <dc:date>2018-01-17T22:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with dates and current selections in set expression</title>
      <link>https://community.qlik.com/t5/QlikView/Trouble-with-dates-and-current-selections-in-set-expression/m-p/1803#M511763</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunately, still nothing in the select state.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jan 2018 22:29:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Trouble-with-dates-and-current-selections-in-set-expression/m-p/1803#M511763</guid>
      <dc:creator>timmarsh</dc:creator>
      <dc:date>2018-01-17T22:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with dates and current selections in set expression</title>
      <link>https://community.qlik.com/t5/QlikView/Trouble-with-dates-and-current-selections-in-set-expression/m-p/1804#M511764</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is the correct previous month expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've no idea why the forcing of values of month, year and day to empty makes it correct.&amp;nbsp; I'd love to understand why!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum({$&amp;lt;Date = {"&amp;gt;=$(=monthstart(addmonths(Max(Date),-1)))&amp;lt;=$(=monthend(addmonths(Max(Date),-1)))"}, Day=, Year=, Month=&amp;gt;} DS_Complete_Counter)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jan 2018 22:31:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Trouble-with-dates-and-current-selections-in-set-expression/m-p/1804#M511764</guid>
      <dc:creator>timmarsh</dc:creator>
      <dc:date>2018-01-17T22:31:29Z</dc:date>
    </item>
  </channel>
</rss>

