<?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 YTD calculation based on user selection in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/YTD-calculation-based-on-user-selection/m-p/141889#M21475</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't have much time to look at your code right now. But here is a thread that may help you get started.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;http://community.qlik.com/forums/t/15820.aspx&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Apr 2009 02:53:14 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-04-21T02:53:14Z</dc:date>
    <item>
      <title>YTD calculation based on user selection</title>
      <link>https://community.qlik.com/t5/QlikView/YTD-calculation-based-on-user-selection/m-p/141888#M21474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How to calculate YTD based on user selection. If user selects period 010.2009 it is just displaying that period data. My time line sample code is as follows &amp;amp; YTD calculations is sum(cost * TTL_YTD)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;STRONG&gt;monthstart&lt;/STRONG&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;STRONG&gt;addmonths&lt;/STRONG&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;STRONG&gt;COBK.BUDAT&lt;/STRONG&gt;&lt;STRONG&gt;,&lt;/STRONG&gt;&lt;STRONG&gt;9&lt;/STRONG&gt;&lt;STRONG&gt;))&lt;/STRONG&gt; &lt;STRONG&gt;as&lt;/STRONG&gt; &lt;STRONG&gt;&lt;/STRONG&gt;PostingPeriod &lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;PostingPeriod &lt;B&gt;as&lt;/B&gt; TL_Date,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MINMAX:&lt;/P&gt;&lt;P&gt;LOAD min(TL_Date) as MinDate,&lt;/P&gt;&lt;P&gt;max(TL_Date) as MaxDate&lt;/P&gt;&lt;P&gt;RESIDENT LINKTAB&lt;/P&gt;&lt;P&gt;GROUP BY 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET MinDate = peek('MinDate');&lt;/P&gt;&lt;P&gt;LET MaxDate = peek('MaxDate');&lt;/P&gt;&lt;P&gt;&lt;B&gt;LET&lt;/B&gt; NoDays = MaxDate - MinDate + 1;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;&lt;B&gt;DROP&lt;/B&gt; &lt;B&gt;TABLE&lt;/B&gt; &lt;I&gt;MINMAX;&lt;/I&gt;&lt;/P&gt;&lt;P style="font-style: italic; line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;&lt;B&gt;LOAD&lt;/B&gt; *,&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;num(Month(TL_Date)) &lt;B&gt;as&lt;/B&gt; TL_FiscPeriod,&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;year(TL_Date) &lt;B&gt;as&lt;/B&gt; TL_FiscYear,&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;inyeartodate(TL_Date, &lt;B&gt;&lt;I&gt;'$(MaxDate)'&lt;/I&gt;&lt;/B&gt;, 0, 1) * -1 &lt;B&gt;as&lt;/B&gt; TL_YTD,&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt; line-height: normal; mso-layout-grid-align: none;"&gt;addmonths(TL_Date, -9) &lt;B&gt;as&lt;/B&gt; TL_CalDate;&lt;/P&gt;&lt;P&gt;&lt;B&gt;LOAD&lt;/B&gt; date(&lt;B&gt;&lt;I&gt;'$(MaxDate)'&lt;/I&gt;&lt;/B&gt; - recno() + 1) &lt;B&gt;as&lt;/B&gt; TL_Date &lt;B&gt;AUTOGENERATE&lt;/B&gt; &lt;B&gt;&lt;I&gt;$(NoDays)&lt;/I&gt;&lt;/B&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Apr 2009 02:23:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/YTD-calculation-based-on-user-selection/m-p/141888#M21474</guid>
      <dc:creator />
      <dc:date>2009-04-21T02:23:17Z</dc:date>
    </item>
    <item>
      <title>YTD calculation based on user selection</title>
      <link>https://community.qlik.com/t5/QlikView/YTD-calculation-based-on-user-selection/m-p/141889#M21475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't have much time to look at your code right now. But here is a thread that may help you get started.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;http://community.qlik.com/forums/t/15820.aspx&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Apr 2009 02:53:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/YTD-calculation-based-on-user-selection/m-p/141889#M21475</guid>
      <dc:creator />
      <dc:date>2009-04-21T02:53:14Z</dc:date>
    </item>
    <item>
      <title>YTD calculation based on user selection</title>
      <link>https://community.qlik.com/t5/QlikView/YTD-calculation-based-on-user-selection/m-p/141890#M21476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The version being used is 8.2 so cannot use set analysis.Should the YTD amount be calculated in the script? Could you provide sample code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Apr 2009 03:42:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/YTD-calculation-based-on-user-selection/m-p/141890#M21476</guid>
      <dc:creator />
      <dc:date>2009-04-24T03:42:57Z</dc:date>
    </item>
    <item>
      <title>YTD calculation based on user selection</title>
      <link>https://community.qlik.com/t5/QlikView/YTD-calculation-based-on-user-selection/m-p/141891#M21477</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check forum for Qlikview cookbook provided by Rob Wunderlich. He shows a smart technique for user date range selection :&lt;/P&gt;&lt;P&gt;/* This section just creates some test data */&lt;BR /&gt;data:&lt;BR /&gt;LET vEndDate = num(today(1)); // End at today's date&lt;BR /&gt;LET vStartDate = num(addmonths(today(1),-14)) -1; // Start at 14 months earlier than today&lt;BR /&gt;TestData:&lt;BR /&gt;LOAD date($(vStartDate) + IterNo()) as Date&lt;BR /&gt;AUTOGENERATE 1&lt;BR /&gt;WHILE $(vStartDate) + IterNo() &amp;lt;= $(vEndDate)&lt;BR /&gt;;&lt;BR /&gt;/* End of test data */&lt;BR /&gt;&lt;BR /&gt;/* This script demonstrates assigning Dates to named groups, such as "Yesterday" or "Last Week".&lt;BR /&gt;Date table was created on the previous tab.&lt;BR /&gt;*/&lt;BR /&gt;&lt;BR /&gt;// Assign current date to a variable. Makes INLINE below a little neater and ensures we don't cross midnight boundry.&lt;BR /&gt;LET vToday=today(1);&lt;BR /&gt;&lt;BR /&gt;Ranges:&lt;BR /&gt;// Use the "evaluate()" function to execute the input function text and convert it to actual date values.&lt;BR /&gt;LOAD Range, date(evaluate(RangeStart)) as RangeStart, date(evaluate(RangeEnd)) as RangeEnd&lt;BR /&gt;;&lt;BR /&gt;/* The INLINE data defines the Range Name, Starting date of the Range, and Ending date of the Range.&lt;BR /&gt;The Start/End values are defined using standard QV date functions.&lt;BR /&gt;Semicolon is used for a field delimeter because some of the functions contain commas.&lt;BR /&gt;*/&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;Range; RangeStart; RangeEnd&lt;BR /&gt;Today; vToday; DayEnd(vToday)&lt;BR /&gt;Yesterday; vToday-1; DayEnd(vToday-1)&lt;BR /&gt;This Week; WeekStart(vToday); WeekEnd(vToday)&lt;BR /&gt;Last Week; WeekStart(vToday,-1); WeekEnd(vToday, -1)&lt;BR /&gt;Last 2 Weeks; WeekStart(today(1),-1); WeekEnd(today(1))&lt;BR /&gt;This Month; MonthStart(vToday); MonthEnd(vToday)&lt;BR /&gt;Last Month; MonthStart(vToday,-1); MonthEnd(vToday,-1)&lt;BR /&gt;Last Two Months; MonthStart(vToday,-1); MonthEnd(vToday)&lt;BR /&gt;This Year; YearStart(vToday); YearEnd(vToday)&lt;BR /&gt;Last Year; YearStart(vToday,-1); YearEnd(vToday,-1)&lt;BR /&gt;] (delimiter is ';')&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;/*&lt;BR /&gt;Use IntervalMatch to link the Date field into multiple Range fields.&lt;BR /&gt;Doing a JOIN avoids creating a messy synthetic key.&lt;BR /&gt;*/&lt;BR /&gt;JOIN (Ranges) IntervalMatch (Date) LOAD RangeStart, RangeEnd RESIDENT Ranges;&lt;BR /&gt;// Because we did a JOIN, we may drop the the Start/End fields.&lt;BR /&gt;DROP FIELDS RangeStart, RangeEnd;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Apr 2009 16:45:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/YTD-calculation-based-on-user-selection/m-p/141891#M21477</guid>
      <dc:creator>yblake</dc:creator>
      <dc:date>2009-04-24T16:45:11Z</dc:date>
    </item>
  </channel>
</rss>

