<?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 Half Year To Date HYTD ? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Half-Year-To-Date-HYTD/m-p/211280#M65592</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok. Here is your half year to date flag expression:&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;=if(year(Date) = year(today()), if(InYearToDate(Date,YearStart(today()), 1, 7), 'Second half of Year', 'First half of Year'))&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 01 Jul 2010 19:11:08 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-07-01T19:11:08Z</dc:date>
    <item>
      <title>Half Year To Date HYTD ?</title>
      <link>https://community.qlik.com/t5/QlikView/Half-Year-To-Date-HYTD/m-p/211277#M65589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to create a Half Year To Date type of function. I know that there is no inhalfyeartodate function so I am trying to manually create it. I went down this road:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;IF(MONTH($(varToday)) &amp;lt; 7, inyeartodate(TempDate, $(varToday), 0) * -1,&lt;BR /&gt; IF(MONTH($(varToday)) &amp;lt; 10, inquartertodate(TempDate, $(varToday), 0) * -1,&lt;BR /&gt; IF(MONTH($(varToday)) &amp;lt; 13,inquartertodate(TempDate, $(varToday), 0) * -1))) AS CurHYTDFlag&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;The problem here is that when the current date is in the last quarter, it will only flag the dates in last quarter rather than last quarter AND the quarter before.&lt;/P&gt;&lt;P&gt;Any suggestions are appreciated!&lt;/P&gt;&lt;P&gt;Aaron&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Jul 2010 15:59:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Half-Year-To-Date-HYTD/m-p/211277#M65589</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-01T15:59:38Z</dc:date>
    </item>
    <item>
      <title>Half Year To Date HYTD ?</title>
      <link>https://community.qlik.com/t5/QlikView/Half-Year-To-Date-HYTD/m-p/211278#M65590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Instead of having a pain about how to calculate the flag, it's much easier to calculate real YTD or HYTD of MTD in charts.&lt;/P&gt;&lt;P&gt;Here is unique expression for this:&lt;/P&gt;&lt;P&gt;This is YTD of current Year for date range selection&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({1 &amp;lt;Date={"$(='&amp;gt;=' &amp;amp; &lt;B&gt;YearStart(max({$} Date))&lt;/B&gt; &amp;amp; '&amp;lt;=' &amp;amp; max({$} Date) )"}&amp;gt;} total Amount)&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;All what you need is just to replace bold part by start date of your period. In your case, it should be 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;sum({1 &amp;lt;Date={"$(='&amp;gt;=' &amp;amp; &lt;B&gt;AddMonths(YearStart(max({$} Date)), 6)&lt;/B&gt; &amp;amp; '&amp;lt;=' &amp;amp; max({$} Date) )"}&amp;gt;} total Amount)&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;See the example in attachment.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Jul 2010 17:39:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Half-Year-To-Date-HYTD/m-p/211278#M65590</guid>
      <dc:creator />
      <dc:date>2010-07-01T17:39:23Z</dc:date>
    </item>
    <item>
      <title>Half Year To Date HYTD ?</title>
      <link>https://community.qlik.com/t5/QlikView/Half-Year-To-Date-HYTD/m-p/211279#M65591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to keep as many calculations as possible inside the script for UI efficiency sake, but this suggestion is good.&lt;/P&gt;&lt;P&gt;Thanks for your input.&lt;/P&gt;&lt;P&gt;Aaron&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Jul 2010 18:03:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Half-Year-To-Date-HYTD/m-p/211279#M65591</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-01T18:03:33Z</dc:date>
    </item>
    <item>
      <title>Half Year To Date HYTD ?</title>
      <link>https://community.qlik.com/t5/QlikView/Half-Year-To-Date-HYTD/m-p/211280#M65592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok. Here is your half year to date flag expression:&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;=if(year(Date) = year(today()), if(InYearToDate(Date,YearStart(today()), 1, 7), 'Second half of Year', 'First half of Year'))&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Jul 2010 19:11:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Half-Year-To-Date-HYTD/m-p/211280#M65592</guid>
      <dc:creator />
      <dc:date>2010-07-01T19:11:08Z</dc:date>
    </item>
  </channel>
</rss>

