<?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/148092#M505278</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;&amp;lt;blockquote&amp;gt;&amp;lt;pre&amp;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;P&gt;&lt;/P&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;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Jul 2009 15:19:49 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-07-01T15:19:49Z</dc:date>
    <item>
      <title>Set Analysis - Date filters</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-filters/m-p/148092#M505278</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;&amp;lt;blockquote&amp;gt;&amp;lt;pre&amp;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;P&gt;&lt;/P&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;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2009 15:19:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Date-filters/m-p/148092#M505278</guid>
      <dc:creator />
      <dc:date>2009-07-01T15:19:49Z</dc:date>
    </item>
  </channel>
</rss>

