<?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: Set modifiers for variable-based difference comparison in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-modifiers-for-variable-based-difference-comparison/m-p/109770#M457605</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;sum( Aggr( &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if ( (EV-vBuffer) &amp;lt; AV AND &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;(EV+vBuffer) &amp;gt; AV,&amp;nbsp; 1, 0 ), UniqueID))&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 25 Sep 2018 21:25:17 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2018-09-25T21:25:17Z</dc:date>
    <item>
      <title>Set modifiers for variable-based difference comparison</title>
      <link>https://community.qlik.com/t5/QlikView/Set-modifiers-for-variable-based-difference-comparison/m-p/109769#M457604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Simplified scenario:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have 3 fields loaded {UniqueRecordID, EstimatedValue, ActualValue}. For sake of brevity let's call them {ID, EV, AV}.&lt;/P&gt;&lt;P&gt;I then need to introduce a user-modifiable buffer, vBuffer, that will define the acceptable margin of error around EV, such that if&lt;/P&gt;&lt;P&gt;EV-vBuffer &amp;lt; AV &amp;lt; EV+vBuffer &lt;/P&gt;&lt;P&gt;we are happy and otherwise we're not. In words: AV must fall within the (user controlled) buffer zone of EV.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The end game is to present the data in a stacked Bar Chart with series "Happy" and "Not Happy" counting the unique IDs for each category.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This sounds extremely simple, and hence must be possible. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In a table, I can get the desired categorization on a per-line basis, using an if() statement:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt; if ( (EV-vBuffer) &amp;lt; AV AND &lt;SPAN style="font-size: 13.3333px;"&gt;(EV+vBuffer) &amp;gt; AV,&amp;nbsp; 'Happy', 'Not Happy' )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the chart, I can use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;sum ( &lt;SPAN style="font-size: 13.3333px;"&gt;if ( (EV-vBuffer) &amp;lt; AV AND &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;(EV+vBuffer) &amp;gt; AV,&amp;nbsp; 1, 0 ) )&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;but that's a sum across all rows and not just the unique ones &lt;EM&gt;(I know that with the scenario I'm outlining, uniqueness could be ensured through other, simpler ways, but the real data set is rather complex, with multiple joined tables, and has to make allowances for for a long list of filters and calculations, so I need solid foundational logic)&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bottom line; I'm after a set modifier:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;count (distinct {$ &amp;lt;&lt;STRONG&gt;Magic&lt;/STRONG&gt;&amp;gt;} ID)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tried a number of things, but failed miserably each time. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;QV Nov 2017 SR5 | 12.20.20600.0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Sep 2018 21:09:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-modifiers-for-variable-based-difference-comparison/m-p/109769#M457604</guid>
      <dc:creator>jwaligora</dc:creator>
      <dc:date>2018-09-25T21:09:31Z</dc:date>
    </item>
    <item>
      <title>Re: Set modifiers for variable-based difference comparison</title>
      <link>https://community.qlik.com/t5/QlikView/Set-modifiers-for-variable-based-difference-comparison/m-p/109770#M457605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;sum( Aggr( &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if ( (EV-vBuffer) &amp;lt; AV AND &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;(EV+vBuffer) &amp;gt; AV,&amp;nbsp; 1, 0 ), UniqueID))&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Sep 2018 21:25:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-modifiers-for-variable-based-difference-comparison/m-p/109770#M457605</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2018-09-25T21:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: Set modifiers for variable-based difference comparison</title>
      <link>https://community.qlik.com/t5/QlikView/Set-modifiers-for-variable-based-difference-comparison/m-p/109771#M457606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or maybe&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Count({&amp;lt;ID = {"=&lt;SPAN style="font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; (EV-vBuffer) &amp;lt; AV AND &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;(EV+vBuffer) &amp;gt; AV&lt;/SPAN&gt;"}&amp;gt;} DISTINCT ID)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Sep 2018 21:27:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-modifiers-for-variable-based-difference-comparison/m-p/109771#M457606</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2018-09-25T21:27:11Z</dc:date>
    </item>
    <item>
      <title>Re: Set modifiers for variable-based difference comparison</title>
      <link>https://community.qlik.com/t5/QlikView/Set-modifiers-for-variable-based-difference-comparison/m-p/109772#M457607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bingo on both counts!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I marked the second one correct because I completely forgot about the Aggr() function, meanwhile I have zero excuse for not arriving at the second option sooner.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks bunches!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2018 20:27:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-modifiers-for-variable-based-difference-comparison/m-p/109772#M457607</guid>
      <dc:creator>jwaligora</dc:creator>
      <dc:date>2018-09-27T20:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: Set modifiers for variable-based difference comparison</title>
      <link>https://community.qlik.com/t5/QlikView/Set-modifiers-for-variable-based-difference-comparison/m-p/109773#M457608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's a sandbox for testing / playing with Stefan's solution.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2018 20:31:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-modifiers-for-variable-based-difference-comparison/m-p/109773#M457608</guid>
      <dc:creator>jwaligora</dc:creator>
      <dc:date>2018-09-27T20:31:24Z</dc:date>
    </item>
  </channel>
</rss>

