<?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 Range of Dates exclude Weekends in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Range-of-Dates-exclude-Weekends/m-p/162647#M502703</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi NMiller,&lt;/P&gt;&lt;P&gt;I tried your suggestion, but it doesn't work for me. It seems that the second part (&lt;I&gt;$(=date((max({&amp;lt;DotW-={'Sun','Sat'}&amp;gt;}Date, 5))))&lt;/I&gt;) of the set analysis is not returning any value.&lt;/P&gt;&lt;P&gt;This is the other way that I worked on. Seems working fine:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Sum ({&amp;lt;Day-={7,$(=if(Day=6,1,8))},Date={"&amp;lt;=$(=max(Date))&amp;gt;$(=date(max(Date)-6))"}&amp;gt;} Amount)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;*the requirement changed a bit... it only excludes Sundays. But if you want to exclude Sat and Sun, just change it to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Sum ({&amp;lt;Day-={7,6},Date={"&amp;lt;=$(=max(Date))&amp;gt;$(=date(max(Date)-7))"}&amp;gt;} Amount)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Aug 2010 15:18:58 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-08-17T15:18:58Z</dc:date>
    <item>
      <title>Range of Dates exclude Weekends</title>
      <link>https://community.qlik.com/t5/QlikView/Range-of-Dates-exclude-Weekends/m-p/162645#M502701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;I want to get the dates 5 days before the selected date. Currently I'm using the following expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;sum({$&amp;lt;Date={"&amp;lt;=$(=max(Date))&amp;gt;$(=date((max(Date)-5)))"}&amp;gt;} Amount)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;But I want to exclude Weekends (Saturday and Sunday) from the date range. I still want to keep the 5 days range. For example, if the user select a date that falls on Tuesday, it will include Wed, Thurs, Fri &lt;I&gt;&amp;lt;Sat and Sun skipped&amp;gt;&lt;/I&gt; Mon, Tues. Any way to do this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Aug 2010 17:20:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Range-of-Dates-exclude-Weekends/m-p/162645#M502701</guid>
      <dc:creator />
      <dc:date>2010-08-16T17:20:13Z</dc:date>
    </item>
    <item>
      <title>Range of Dates exclude Weekends</title>
      <link>https://community.qlik.com/t5/QlikView/Range-of-Dates-exclude-Weekends/m-p/162646#M502702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you have any calendar fields (particularly Day of the Week) associated with the Date? If so, you can add some Set Analysis in your Max functions to exclude those dates.&lt;/P&gt;&lt;P&gt;If you have a numerical Day of the Week field then something like:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;sum({$&amp;lt;Date={"&amp;lt;=$(=max({&amp;lt;DotW-={0,6}&amp;gt;}Date))&lt;BR /&gt; &amp;gt;$(=date((max({&amp;lt;DotW-={0,6}&amp;gt;}Date, 5))))"}&amp;gt;} Amount)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;If you use the QlikView WeekDay function to add Day of the Week to your load, you could use something like:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;sum({$&amp;lt;Date={"&amp;lt;=$(=max({&amp;lt;DotW-={'Sun','Sat'}&amp;gt;}Date))&lt;BR /&gt; &amp;gt;$(=date((max({&amp;lt;DotW-={'Sun','Sat'}&amp;gt;}Date, 5))))"}&amp;gt;} Amount)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;I changed the Max - 5 to use the second parameter of the Max function instead. Max(FIELD, 5) will pull the fifth highest value of FIELD. If you don't have all dates in your data set, then this may not work.&lt;/P&gt;&lt;P&gt;You could also use an if/then inside your max functions, but Set Analysis would probably be preferred.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Aug 2010 17:29:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Range-of-Dates-exclude-Weekends/m-p/162646#M502702</guid>
      <dc:creator />
      <dc:date>2010-08-16T17:29:54Z</dc:date>
    </item>
    <item>
      <title>Range of Dates exclude Weekends</title>
      <link>https://community.qlik.com/t5/QlikView/Range-of-Dates-exclude-Weekends/m-p/162647#M502703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi NMiller,&lt;/P&gt;&lt;P&gt;I tried your suggestion, but it doesn't work for me. It seems that the second part (&lt;I&gt;$(=date((max({&amp;lt;DotW-={'Sun','Sat'}&amp;gt;}Date, 5))))&lt;/I&gt;) of the set analysis is not returning any value.&lt;/P&gt;&lt;P&gt;This is the other way that I worked on. Seems working fine:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Sum ({&amp;lt;Day-={7,$(=if(Day=6,1,8))},Date={"&amp;lt;=$(=max(Date))&amp;gt;$(=date(max(Date)-6))"}&amp;gt;} Amount)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;*the requirement changed a bit... it only excludes Sundays. But if you want to exclude Sat and Sun, just change it to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Sum ({&amp;lt;Day-={7,6},Date={"&amp;lt;=$(=max(Date))&amp;gt;$(=date(max(Date)-7))"}&amp;gt;} Amount)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Aug 2010 15:18:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Range-of-Dates-exclude-Weekends/m-p/162647#M502703</guid>
      <dc:creator />
      <dc:date>2010-08-17T15:18:58Z</dc:date>
    </item>
  </channel>
</rss>

