<?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: Sum expression based on filters in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Sum-expression-based-on-filters/m-p/1199930#M22705</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was able to get this to work based on another thread I found:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum( {1 &amp;lt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [ClosedDate.autoCalendar.Year]={$(=chr(34) &amp;amp; concat(distinct [CreatedDate.autoCalendar.Year], chr(34)&amp;amp;','&amp;amp;chr(34)) &amp;amp; chr(34))},&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [ClosedDate.autoCalendar.Month]={$(=chr(34) &amp;amp; concat(distinct [CreatedDate.autoCalendar.Month], chr(34)&amp;amp;','&amp;amp;chr(34)) &amp;amp; chr(34))}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;} [Closed])&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 28 Oct 2016 19:02:35 GMT</pubDate>
    <dc:creator />
    <dc:date>2016-10-28T19:02:35Z</dc:date>
    <item>
      <title>Sum expression based on filters</title>
      <link>https://community.qlik.com/t5/App-Development/Sum-expression-based-on-filters/m-p/1199929#M22704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I'm trying to figure out how I can sum a field based on the selected filters on my sheet.&amp;nbsp; I'm working with a dataset of work orders and I have a count based on when the work order was created and filtered by the currently selected year/month which works fine but now that the data is filtered by the create date I need to get a count of work orders that were closed in the same range.&amp;nbsp; There can be work orders that were opened in a previous month that currently isn't selected but were closed the next month.&amp;nbsp; These records would be excluded because of the filter but I need to get a count of those.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.g. Work order #1&lt;/P&gt;&lt;P&gt;Created 8/1/2016&lt;/P&gt;&lt;P&gt;Closed 9/1/2016&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Filter #1 year of create date = 2016, filter #2 month of create date = Oct, Sep&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My dataset would not include this record in my table object since it was opened before September but I still need to include it in the closed count since that does fall in my filter selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found this link here but I couldn't get it to work with Qlik Sense:&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.resultdata.com/qlikview-set-analysis-ignore-all-filters-but-these-two/" title="https://www.resultdata.com/qlikview-set-analysis-ignore-all-filters-but-these-two/"&gt;https://www.resultdata.com/qlikview-set-analysis-ignore-all-filters-but-these-two/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's my vSelectedYear variable:&lt;/P&gt;&lt;P&gt;If(GetSelectedCount([CreatedDate.autoCalendar.Year])&amp;gt; 0, concat (DISTINCT [CreatedDate.autoCalendar.Year], ','), '*' )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's my vSelectedMonth variable:&lt;/P&gt;&lt;P&gt;If(GetSelectedCount([CreatedDate.autoCalendar.Month])&amp;gt; 0, concat (DISTINCT [CreatedDate.autoCalendar.Month], ','), '*' )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the measure I'm attempting to test with (the closed field is just a 1 or 0 that I added to my script which is set to 1 if a close date is set or not:&lt;/P&gt;&lt;P&gt;Sum({1&amp;lt;[ClosedDate.autoCalendar.Year]={$(vSelectedYear)}&amp;gt;}[Closed])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm have a text &amp;amp; image object set for $(vSelectedYear) and $(vSelectedMonth) to the right of the filters for testing which appears to be working, but the last text &amp;amp; image object using the expression "Sum({1&amp;lt;[ClosedDate.autoCalendar.Year]={$(vSelectedYear)}&amp;gt;}[Closed])" doesn't seem to work.&amp;nbsp; Any help would be appreciated.&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="142381" alt="Untitled.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/142381_Untitled.png" style="height: 218px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It does work as expected if I manually replace $(vSelectedYear) with "2016","2015" if i wanted to include that year as well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Oct 2016 16:25:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sum-expression-based-on-filters/m-p/1199929#M22704</guid>
      <dc:creator />
      <dc:date>2016-10-28T16:25:31Z</dc:date>
    </item>
    <item>
      <title>Re: Sum expression based on filters</title>
      <link>https://community.qlik.com/t5/App-Development/Sum-expression-based-on-filters/m-p/1199930#M22705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was able to get this to work based on another thread I found:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum( {1 &amp;lt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [ClosedDate.autoCalendar.Year]={$(=chr(34) &amp;amp; concat(distinct [CreatedDate.autoCalendar.Year], chr(34)&amp;amp;','&amp;amp;chr(34)) &amp;amp; chr(34))},&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [ClosedDate.autoCalendar.Month]={$(=chr(34) &amp;amp; concat(distinct [CreatedDate.autoCalendar.Month], chr(34)&amp;amp;','&amp;amp;chr(34)) &amp;amp; chr(34))}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;} [Closed])&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Oct 2016 19:02:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sum-expression-based-on-filters/m-p/1199930#M22705</guid>
      <dc:creator />
      <dc:date>2016-10-28T19:02:35Z</dc:date>
    </item>
  </channel>
</rss>

