<?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 - Date From and To Variables in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-From-and-To-Variables/m-p/1292466#M403912</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your advise.&lt;/P&gt;&lt;P&gt;i will reformat the date field in the&amp;nbsp; script and try again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/Brad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 05 Feb 2017 09:50:49 GMT</pubDate>
    <dc:creator />
    <dc:date>2017-02-05T09:50:49Z</dc:date>
    <item>
      <title>Set Analysis - Date From and To Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-From-and-To-Variables/m-p/1292464#M403910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi i am stuck with the following problem that my Set analysis returns 0.&lt;/P&gt;&lt;P&gt;my Dates in the Qlikview application are strings i believe.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so i have created a few variables to help me along the way in doing a R13_24 Analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the query Realised with Variables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({$&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Year_Month&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;=,&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Bokningsdatum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;= {&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;"&amp;gt;=$(=vStartDate) &amp;lt;=$(=vEndDate)"&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;}&amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Belopp_HB&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)&lt;BR /&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG&gt;&lt;EM style="color: #808080;"&gt;vMaxBokningsDatum)&lt;/EM&gt;&lt;/STRONG&gt;=max&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Bokningsdatum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG&gt;&lt;EM style="color: #808080;"&gt;vMinBokningsDatum&lt;/EM&gt;&lt;/STRONG&gt;=min&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Bokningsdatum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;vStartDate = &lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;addmonths&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;monthend&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 8pt;"&gt;$(vMinBokningsDatum)&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt;)-1,-12) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;vEndDate = &lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;addmonths&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;monthend&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 8pt;"&gt;$(vMaxBokningsDatum)&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt;)-1,-12) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is what it looks like with the variables exposed&lt;/P&gt;&lt;P&gt;Sum({$&amp;lt;Bokningsdatum= {"&amp;gt;=addmonths(monthend(min(Bokningsdatum))+1,-24) &amp;lt;=addmonths(monthend(max(Bokningsdatum))-1,-12)"}&amp;gt;} Amount)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone point me in the right direction. is my set analysis wrong or are my fields not compatible?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;Brad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 05 Feb 2017 00:42:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-From-and-To-Variables/m-p/1292464#M403910</guid>
      <dc:creator />
      <dc:date>2017-02-05T00:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis - Date From and To Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-From-and-To-Variables/m-p/1292465#M403911</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is your date field format here? Do you use Date() function in the script for Bokningsdatum? Like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Date(Bokningsdatum) as Bokningsdatum&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or do you provide your own format?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Date(Bokningsdatum, 'DD/MM/YYYY') as Bokningsdatum&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are doing it the second way, you might need to use Date() function in your expressions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=Sum({$&amp;lt;Year_Month=, Bokningsdatum= {"&amp;gt;=$(=Date(vStartDate, 'DD/MM/YYYY')) &amp;lt;=$(=Date(vEndDate&lt;STRONG style="font-size: 13.3333px;"&gt;, 'DD/MM/YYYY')&lt;/STRONG&gt;)"}&amp;gt;} Belopp_HB)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read about dates in general and dates in set analysis here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/2954"&gt;Why don’t my dates work?&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/2622"&gt;Get the Dates Right&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/4394"&gt;Dates in Set Analysis&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 05 Feb 2017 03:28:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-From-and-To-Variables/m-p/1292465#M403911</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-02-05T03:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis - Date From and To Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-From-and-To-Variables/m-p/1292466#M403912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your advise.&lt;/P&gt;&lt;P&gt;i will reformat the date field in the&amp;nbsp; script and try again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/Brad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 05 Feb 2017 09:50:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-From-and-To-Variables/m-p/1292466#M403912</guid>
      <dc:creator />
      <dc:date>2017-02-05T09:50:49Z</dc:date>
    </item>
  </channel>
</rss>

