<?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 - returning data from Month before current selection in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-Analysis-returning-data-from-Month-before-current-selection/m-p/1165591#M379513</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would suggest that you put your expression into a straight table expression and leave the expression label empty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then hover with the mouse over the expression header. You should see your expression with all dollar sign expansions evaluated and replaced. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What do you see?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also note that your numeric search values should match exactely the values of the field you are searching in:&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;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I assume you have a single value selected in &lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333px;"&gt;Calendar_MonthYear_Select1 field, otherwise, use an aggregation function when using this field in your dollar sign expansion expressions, like&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333px;"&gt;$(=AddMonths(&lt;STRONG&gt;Max&lt;/STRONG&gt;(Calendar_MonthYear_Select1),-1))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Jun 2016 19:55:43 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2016-06-21T19:55:43Z</dc:date>
    <item>
      <title>Set Analysis - returning data from Month before current selection</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-returning-data-from-Month-before-current-selection/m-p/1165590#M379512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good afternoon,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm attempting to write a Set Analysis expression which takes the Month-Year currently selected, and returns a count of the data from the previous month which is divided by the total number of days in the previous month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So far I have the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;count&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;({1 &amp;lt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 10pt;"&gt;[Status Category]&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; = {'FFP'}, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 10pt;"&gt;Calendar_Date&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; = {&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 10pt;"&gt;"&amp;lt;= $(=MonthEnd(AddMonths(Calendar_MonthYear_Select1,-1))) &amp;gt;=$(=AddMonths(Calendar_MonthYear_Select1,-1))"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;} &amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 10pt;"&gt;[Calendar_Date]&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;)&amp;nbsp;&amp;nbsp;&amp;nbsp; //Set analysis expression&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;/&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;Day&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;MonthEnd&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;AddMonths&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 10pt;"&gt;Calendar_MonthYear_Select1&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;,-1)))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // This part of the expression divides the result from the set analysis by the total number of days in the previous month - this part is working&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;This doesn't return the correct data though.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;I'm putting the 1 at the beginning of the expression to force the expression to use data from the entire dataset, and not just the selected dataset (which would only be the data from the currently selected month-year.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;I then use $ at the part of the expression where I am utitlsing the currently selected month-year to use in the expression. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;I hope I've described this well enough for someone to offer some assistance. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Calendar_MonthYear_Select1 is the name of the field which is being used to filter data, so this shows the 'Month-Year' in the format MMM-YYYY eg Mar-2016&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Calendar_date is normal datetime - eg 01/03/2016&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;I'm trying to tell the set to only fetch data which is between the 1st and Last date in the previous month.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jun 2016 14:45:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-returning-data-from-Month-before-current-selection/m-p/1165590#M379512</guid>
      <dc:creator />
      <dc:date>2016-06-21T14:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis - returning data from Month before current selection</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-returning-data-from-Month-before-current-selection/m-p/1165591#M379513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would suggest that you put your expression into a straight table expression and leave the expression label empty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then hover with the mouse over the expression header. You should see your expression with all dollar sign expansions evaluated and replaced. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What do you see?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also note that your numeric search values should match exactely the values of the field you are searching in:&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;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I assume you have a single value selected in &lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333px;"&gt;Calendar_MonthYear_Select1 field, otherwise, use an aggregation function when using this field in your dollar sign expansion expressions, like&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333px;"&gt;$(=AddMonths(&lt;STRONG&gt;Max&lt;/STRONG&gt;(Calendar_MonthYear_Select1),-1))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jun 2016 19:55:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-returning-data-from-Month-before-current-selection/m-p/1165591#M379513</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-06-21T19:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis - returning data from Month before current selection</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-returning-data-from-Month-before-current-selection/m-p/1165592#M379514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Might just need to give it the right format for the date, like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;...Calendar_Date={"&amp;lt;=$(=date(monthend(addmonths(Calendar_MonthYear_Select1,-1)),'DD/MM/YY'))...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The monthend() function could be messing you up here, as it returns a timestamp, not a date.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jun 2016 21:27:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-returning-data-from-Month-before-current-selection/m-p/1165592#M379514</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2016-06-21T21:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis - returning data from Month before current selection</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-returning-data-from-Month-before-current-selection/m-p/1165593#M379515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks very much to both John Witherspoon and swuehl who assisted my in getting to my answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It turned out that I had a syntax error in my Set Analysis looking at the dates between &amp;lt;= and $&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;swuehl - your tip to put the expression into a straight table helped me to spot this, and the tips on making sure that the dates were in the correct formats across the board we're also essential, and the dates were mismatched.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For anyone looking for an answer on how to do the set analysis between 2 dates, this is the code I used:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;Count&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;({1 &amp;lt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 10pt;"&gt;[Status Category]&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; = {&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 10pt;"&gt;"FFP"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;}, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 10pt;"&gt;Calendar_Date&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; = {&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 10pt;"&gt;"&amp;lt;=$(=date(MonthEnd(AddMonths(Calendar_MonthYear_Select1,-1)),'DD/MM/YYYY')) &amp;gt;=$(=date(AddMonths(Calendar_MonthYear_Select1,-1),'DD/MM/YYYY'))"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;} &amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 10pt;"&gt;[Aircraft Status ID]&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Set analysis expression&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;/&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;Day&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;MonthEnd&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;AddMonths&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 10pt;"&gt;Calendar_MonthYear_Select1&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;,-1)))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //This part of the expression divides the result from the set analysis by the total number of days in the previous month&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jun 2016 16:03:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-returning-data-from-Month-before-current-selection/m-p/1165593#M379515</guid>
      <dc:creator />
      <dc:date>2016-06-23T16:03:41Z</dc:date>
    </item>
  </channel>
</rss>

