<?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 Adding $ current selection to the statement? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Adding-current-selection-to-the-statement/m-p/292529#M108536</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does anyone know how to add current selection to the following expression?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(sum(if (InWeek (DaysFilled.Date, (Today()), -52), DaysFilled.Days))) / (count(distinct(if (InWeek (DaysFilled.Date, (Today()), -52, DaysFilled.Date))))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The expression works but not with current selection&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 Nov 2011 20:43:57 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-11-02T20:43:57Z</dc:date>
    <item>
      <title>Adding $ current selection to the statement?</title>
      <link>https://community.qlik.com/t5/QlikView/Adding-current-selection-to-the-statement/m-p/292529#M108536</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does anyone know how to add current selection to the following expression?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(sum(if (InWeek (DaysFilled.Date, (Today()), -52), DaysFilled.Days))) / (count(distinct(if (InWeek (DaysFilled.Date, (Today()), -52, DaysFilled.Date))))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The expression works but not with current selection&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Nov 2011 20:43:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Adding-current-selection-to-the-statement/m-p/292529#M108536</guid>
      <dc:creator />
      <dc:date>2011-11-02T20:43:57Z</dc:date>
    </item>
    <item>
      <title>Adding $ current selection to the statement?</title>
      <link>https://community.qlik.com/t5/QlikView/Adding-current-selection-to-the-statement/m-p/292530#M108537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you'll have to explain a bit more how this expression doesn't work with current selection. What selection do you make and what's happening wrongly?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a feeling that there is a syntax error in your expression - looks like one of the closing quotes might be misplaced.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I'd recommend to simplify your expression by moving the IF question back to the load script and defining a "flag" that can determine whether the date DaysFilled.Date is within the last 52 weeks from today:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;if (InWeek (DaysFilled.Date, (Today()), -52), 1, 0) as Flag_52Weeks,&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, your expression should look like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({&amp;lt;Flag_52Weeks={1}&amp;gt;}&amp;nbsp;&amp;nbsp; DaysFilled.Days)/ count({&amp;lt;Flag_52Weeks={1}&amp;gt;}&amp;nbsp; distinct DaysFilled.Date)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;much simpler, cleaner and faster... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Nov 2011 22:04:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Adding-current-selection-to-the-statement/m-p/292530#M108537</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2011-11-02T22:04:54Z</dc:date>
    </item>
  </channel>
</rss>

