<?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 Set Analysis - Date filters in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-filters/m-p/148160#M505286</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 need some help on date filters through set analysis. Although I have read widely in the forum, I still cannot figure how to solve me problem.&lt;/P&gt;&lt;P&gt;My application contains one table called Chart of Accounts which have general ledger entries and posting dates. Budget entries are posted once a month. I created a calendar and linked the table to the GL posting dates. Posting dates are not consecutive so the table only pulls the dates from the calendar where postings are made.&lt;/P&gt;&lt;P&gt;When I make a chart showing actual vs budget expenses, I am supposed to calculate the budget YTD in this way:&lt;/P&gt;&lt;P&gt;1. Sum all budgets figures for one whole year eg 2009&lt;/P&gt;&lt;P&gt;2. Calculate the budget YTD by (Number of Days in Date Range Selected) / (Total Days in the Year) times the entire budget figure for the year. For eg for Jan to Apr and a budget of 12000, the Budget YTD would be 120/365 times 12000 = 3945.&lt;/P&gt;&lt;P&gt;My problem comes from the associative way QlikView pulls dates. I simply cannot figure how to get the selection called Number of Days in Date Range Selected and to put it in a Set analysis formula.&lt;/P&gt;&lt;P&gt;I have tried GetFieldSelections(Calendar_Month) but how do I convert the values to calculate number of days the user selects and use this number?&lt;/P&gt;&lt;P&gt;My set analysis currently looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;SUM( {1 &amp;lt; [Calendar_Month] = {GetFieldSelections([Calendar_Month] &amp;gt;} Total [Calendar_YTD] }&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Where [Calendar_YTD] is a boolean number field in the Calendar (0 or 1 depending on whether the current date is YTD)&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Jul 2009 15:13:49 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-07-01T15:13:49Z</dc:date>
    <item>
      <title>Set Analysis - Date filters</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-filters/m-p/148160#M505286</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 need some help on date filters through set analysis. Although I have read widely in the forum, I still cannot figure how to solve me problem.&lt;/P&gt;&lt;P&gt;My application contains one table called Chart of Accounts which have general ledger entries and posting dates. Budget entries are posted once a month. I created a calendar and linked the table to the GL posting dates. Posting dates are not consecutive so the table only pulls the dates from the calendar where postings are made.&lt;/P&gt;&lt;P&gt;When I make a chart showing actual vs budget expenses, I am supposed to calculate the budget YTD in this way:&lt;/P&gt;&lt;P&gt;1. Sum all budgets figures for one whole year eg 2009&lt;/P&gt;&lt;P&gt;2. Calculate the budget YTD by (Number of Days in Date Range Selected) / (Total Days in the Year) times the entire budget figure for the year. For eg for Jan to Apr and a budget of 12000, the Budget YTD would be 120/365 times 12000 = 3945.&lt;/P&gt;&lt;P&gt;My problem comes from the associative way QlikView pulls dates. I simply cannot figure how to get the selection called Number of Days in Date Range Selected and to put it in a Set analysis formula.&lt;/P&gt;&lt;P&gt;I have tried GetFieldSelections(Calendar_Month) but how do I convert the values to calculate number of days the user selects and use this number?&lt;/P&gt;&lt;P&gt;My set analysis currently looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;SUM( {1 &amp;lt; [Calendar_Month] = {GetFieldSelections([Calendar_Month] &amp;gt;} Total [Calendar_YTD] }&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Where [Calendar_YTD] is a boolean number field in the Calendar (0 or 1 depending on whether the current date is YTD)&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2009 15:13:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-filters/m-p/148160#M505286</guid>
      <dc:creator />
      <dc:date>2009-07-01T15:13:49Z</dc:date>
    </item>
    <item>
      <title>Set Analysis - Date filters</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-filters/m-p/148161#M505287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jeanne,&lt;/P&gt;&lt;P&gt;Do you have a Calendar table? I.e. a table with one row per day, containing all the Year, Month, Day, Week, etc. values for that date?&lt;/P&gt;&lt;P&gt;If so, it would be a trivial matter to add a new row:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt; ...&lt;BR /&gt; 1 as DayCounter&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Then, either Sum(DayCounter) or Sum({ &amp;lt; Year = {$(=Max(Year))} &amp;gt; DayCounter) will give you a count of all selected days or all selected days in the latest year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stephen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2009 19:57:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-filters/m-p/148161#M505287</guid>
      <dc:creator>stephencredmond</dc:creator>
      <dc:date>2009-07-01T19:57:07Z</dc:date>
    </item>
    <item>
      <title>Set Analysis - Date filters</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-filters/m-p/148162#M505288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Stephen&lt;/P&gt;&lt;P&gt;Thanks for your suggestion. I have a DayCounter called YTD (basically 0 or 1). The problem I have is that the application only pulls the dates associated the posting dates which means that it only counts the DayCounters with these dates and not with the whole calendar.&lt;/P&gt;&lt;P&gt;I worked out a fix yesterday which I must say is not elegant but allows me to see the date range the user selects. I took the MinString for the field called Month and the MaxString for the field and calculated the number of days the user selected. This would give me a "static" date range with which to do the budget calculations.&lt;/P&gt;&lt;P&gt;In this post, I would also like to find out from you or any one else in the forum how to initialize and use variables in set analysis expressions in charts. How do I write code like that in a chart ? Is it like this eg:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;Let vSelected= GetFieldSelections(Month)&lt;BR /&gt;SUM( { 1 &amp;lt;Month={$(vSelected)} } Amount)&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;I always get an error - is it because I am missing a ; or is it because QlikView does not allow intialization of variables in a Chart expression?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jul 2009 13:24:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-filters/m-p/148162#M505288</guid>
      <dc:creator />
      <dc:date>2009-07-02T13:24:17Z</dc:date>
    </item>
    <item>
      <title>Set Analysis - Date filters</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-filters/m-p/148163#M505289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jeanne,&lt;/P&gt;&lt;P&gt;I normally use an input box formatted as a drop down list and then fed this into a variable. From there I pass the variable into my expression using pretty much the same logic as you have - see following sample.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;SUM({&amp;lt;Month={$(MyReportingMonth)}&amp;gt;}Value)&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;I hope this is of some help.&lt;/P&gt;&lt;P&gt;Rod&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jul 2009 13:55:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-filters/m-p/148163#M505289</guid>
      <dc:creator />
      <dc:date>2009-07-02T13:55:03Z</dc:date>
    </item>
    <item>
      <title>Set Analysis - Date filters</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-filters/m-p/148164#M505290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jane,&lt;/P&gt;&lt;P&gt;Given a max and min month, I might calculate the days between the start and end like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;=&lt;B&gt;Floor&lt;/B&gt;(&lt;B&gt;MonthEnd&lt;/B&gt;(&lt;B&gt;MakeDate&lt;/B&gt;(&lt;B&gt;Max&lt;/B&gt;(&lt;B&gt;Year&lt;/B&gt;), &lt;B&gt;Max&lt;/B&gt;(&lt;B&gt;Month&lt;/B&gt;),1))) - &lt;B&gt;MakeDate&lt;/B&gt;(&lt;B&gt;Max&lt;/B&gt;(&lt;B&gt;Year&lt;/B&gt;), &lt;B&gt;Min&lt;/B&gt;(&lt;B&gt;Month&lt;/B&gt;), 1)&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;There is a problem with the way you are trying to pass the Month list because it is just comma separated while the Set will expect Quotes as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stephen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jul 2009 15:13:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-filters/m-p/148164#M505290</guid>
      <dc:creator>stephencredmond</dc:creator>
      <dc:date>2009-07-02T15:13:53Z</dc:date>
    </item>
    <item>
      <title>Set Analysis - Date filters</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-filters/m-p/148165#M505291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a bit similar problem. I would like to make &lt;B&gt;a single chart comparison between budget and actual sales per months&lt;/B&gt;.&lt;/P&gt;&lt;P&gt;&lt;B&gt;The problem&lt;/B&gt; in here is that I've &lt;B&gt;dates from two calendars&lt;/B&gt;, so if I choose the month dimension from budget calendar, it doesn't affect to the sum of actual sales and vice versa.&lt;/P&gt;&lt;P&gt;And i can't link the budget + actual calendars to master calendar and choose the month from there, because I also need the comparison by ledgers ( so I need to keep the link between budget and actual ledger transactions).&lt;/P&gt;&lt;P&gt;My tables are:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;-Ledger info for all ledgers (Budget per ledger and Actual edger transactios are linked to this)&lt;BR /&gt;-Budget per ledger (Budget calendar is linked to this)&lt;BR /&gt;-Budget calendar&lt;BR /&gt;-Actual ledger transactions (Ledger transaction calendars is linked to this)&lt;BR /&gt;-Ledger transaction calendar&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you if you can think any kind of solution for me, haven't been using qlikview a lot yet..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jul 2009 17:08:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-filters/m-p/148165#M505291</guid>
      <dc:creator />
      <dc:date>2009-07-13T17:08:58Z</dc:date>
    </item>
    <item>
      <title>Set Analysis - Date filters</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-filters/m-p/148166#M505292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there&lt;/P&gt;&lt;P&gt;That is certainly a useful solution and tip I could use in my later applications. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2009 14:00:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-filters/m-p/148166#M505292</guid>
      <dc:creator />
      <dc:date>2009-07-14T14:00:14Z</dc:date>
    </item>
    <item>
      <title>Set Analysis - Date filters</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-filters/m-p/148167#M505293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Stephan&lt;/P&gt;&lt;P&gt;Thanks for your solution. My own solution came close to it except that I did not use the Floor() function before calculating the dates. My solution also checks for leap year and maps number of days to each month. Pretty long but I did not really trust myself to create another parallel calendar.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2009 14:02:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-filters/m-p/148167#M505293</guid>
      <dc:creator />
      <dc:date>2009-07-14T14:02:45Z</dc:date>
    </item>
    <item>
      <title>Set Analysis - Date filters</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-filters/m-p/148168#M505294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jeanne!&lt;/P&gt;&lt;P&gt;did you have similar problems with your graphs and time? I didn't figure out any solution yet, how to make one graph (x values are months) from data which uses two calendars.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2009 14:08:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-filters/m-p/148168#M505294</guid>
      <dc:creator />
      <dc:date>2009-07-14T14:08:15Z</dc:date>
    </item>
    <item>
      <title>Set Analysis - Date filters</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-filters/m-p/148169#M505295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jiir&lt;/P&gt;&lt;P&gt;My application also called for comparing budget with actual figures. I used this solution:&lt;/P&gt;&lt;P&gt;1. For each ledger transaction, I specified whether the transaction was "budget" or "actual"&lt;/P&gt;&lt;P&gt;2.. Linked transactions posting dates to the master calendar (both budget and actual)&lt;/P&gt;&lt;P&gt;3. When it was time to make the chart, I made a filter which took only budget or only actual eg. SUM( IF(BudgetName='Budget', LedgerAmount)).&lt;/P&gt;&lt;P&gt;I hope that helps. This solution calls for only one master calendar.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2009 14:09:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-filters/m-p/148169#M505295</guid>
      <dc:creator />
      <dc:date>2009-07-14T14:09:47Z</dc:date>
    </item>
    <item>
      <title>Set Analysis - Date filters</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-filters/m-p/148170#M505296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Jeanne!&lt;/P&gt;&lt;P&gt;Thank you, that cleared things a lot! got something working ; )&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jul 2009 12:27:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-filters/m-p/148170#M505296</guid>
      <dc:creator />
      <dc:date>2009-07-17T12:27:41Z</dc:date>
    </item>
  </channel>
</rss>

