<?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: Date Field in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Date-Field/m-p/103616#M6986</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just share the way I use to do this, I think it's a little more flexible than set a flag like IsLast60days, because this flag could not reflect correctly if you make a selection on date field.&lt;/P&gt;&lt;P&gt;- As I usually ignore the weekends (Sat, Sun) when loading date dimension, I input a Dateorder to dimension in data load: such as:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;[Dim_Date]:&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;load &lt;STRONG&gt;RowNo()&lt;/STRONG&gt; as DateOrder, * where Exists(DimDateID);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;SQL select DimDateID, [DateCode],&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 10pt;"&gt;from [Dimension_Dates] where IsHoliday &amp;lt;&amp;gt; 'Y' and IsWeekend &amp;lt;&amp;gt; 'Y'&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; order by DimDateID;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then on chart, I can use set analytics to easily get the list of date&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;DateOrder = {"&amp;gt;=$(=Max(DateOrder)-60)"}&amp;gt;} Field)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Jul 2018 03:34:58 GMT</pubDate>
    <dc:creator>thi_pham</dc:creator>
    <dc:date>2018-07-19T03:34:58Z</dc:date>
    <item>
      <title>Date Field</title>
      <link>https://community.qlik.com/t5/App-Development/Date-Field/m-p/103614#M6984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Having trouble creating a field, maybe someone here can explain:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to create a time frame field, basically one that will only show days within the last 60 days when I use the field as opposed to the date field that pulls all the days from beginning of our sales.&amp;nbsp; I imagine that the field will be calculated from the current date field, but just cannot figure out an expression that will do this.&amp;nbsp; Any help is appreciated.&amp;nbsp; Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jul 2018 18:14:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Date-Field/m-p/103614#M6984</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-07-18T18:14:20Z</dc:date>
    </item>
    <item>
      <title>Re: Date Field</title>
      <link>https://community.qlik.com/t5/App-Development/Date-Field/m-p/103615#M6985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In your load script you can create a field to flag the date values that are within the last 60 days. In your app you can then use a set expression to select based on this flag. The flag could be called IsLast60days and contain a 1 if the condition is true and 0 if not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;LOAD&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ....&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SalesDate,&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If (SalesDate &amp;gt;= Floor(Today(1))-60 , 1 , 0 ) AS IsLast60Days,&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In an expression in a chart/table you could sum the sales of the last 60 days like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum( {&amp;lt;IsLast60Days={1}&amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have one or more date related dimension you might also have to use the TOTAL qualifier:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum(TOTAL {&amp;lt;IsLast60Days={1}&amp;gt;} Sales) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or even&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum(TOTAL &amp;lt;Country&amp;gt; {&amp;lt;IsLast60Days={1}&amp;gt;} Sales) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or if more than one dimension apart from the date related dimensions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum(TOTAL &amp;lt;Country,Region&amp;gt; {&amp;lt;IsLast60Days={1}&amp;gt;} Sales) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The last one could be read as "Get the total sum of all sales made within 60 days up to the level of Country and Region"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jul 2018 21:44:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Date-Field/m-p/103615#M6985</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2018-07-18T21:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: Date Field</title>
      <link>https://community.qlik.com/t5/App-Development/Date-Field/m-p/103616#M6986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just share the way I use to do this, I think it's a little more flexible than set a flag like IsLast60days, because this flag could not reflect correctly if you make a selection on date field.&lt;/P&gt;&lt;P&gt;- As I usually ignore the weekends (Sat, Sun) when loading date dimension, I input a Dateorder to dimension in data load: such as:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;[Dim_Date]:&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;load &lt;STRONG&gt;RowNo()&lt;/STRONG&gt; as DateOrder, * where Exists(DimDateID);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;SQL select DimDateID, [DateCode],&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 10pt;"&gt;from [Dimension_Dates] where IsHoliday &amp;lt;&amp;gt; 'Y' and IsWeekend &amp;lt;&amp;gt; 'Y'&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; order by DimDateID;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then on chart, I can use set analytics to easily get the list of date&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;DateOrder = {"&amp;gt;=$(=Max(DateOrder)-60)"}&amp;gt;} Field)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2018 03:34:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Date-Field/m-p/103616#M6986</guid>
      <dc:creator>thi_pham</dc:creator>
      <dc:date>2018-07-19T03:34:58Z</dc:date>
    </item>
  </channel>
</rss>

