<?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 Analysis Trouble with Dual Field in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Trouble-with-Dual-Field/m-p/586562#M217654</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just a suggestion. Why don't you use min instead of max for A.&lt;/P&gt;&lt;P&gt;Like,&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Sum({&amp;lt;One={"=One=Min(TOTAL One)"}&amp;gt;}Two)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 28 Feb 2014 19:23:41 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-02-28T19:23:41Z</dc:date>
    <item>
      <title>Set Analysis Trouble with Dual Field</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Trouble-with-Dual-Field/m-p/586559#M217651</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;I'm having trouble using set analysis with a dual field. I've attached a simple data structure that illustrates the problem. I have two fields, One and Two, that look like&lt;/P&gt;&lt;P&gt;One,Two&lt;/P&gt;&lt;P&gt;A,1&lt;/P&gt;&lt;P&gt;A,2&lt;/P&gt;&lt;P&gt;A,3&lt;/P&gt;&lt;P&gt;A,4&lt;/P&gt;&lt;P&gt;B,5&lt;/P&gt;&lt;P&gt;B,6&lt;/P&gt;&lt;P&gt;B,7&lt;/P&gt;&lt;P&gt;B,8&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have used the dual function in my load script,&lt;/P&gt;&lt;P&gt;If(One='A',dual(One,1),dual(One,2)) as One&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am having trouble using the number portion in set analysis, though. To elaborate:&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;One={'B'}&amp;gt;}Two) works fine (returns 26);&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;One={"=One=Max(TOTAL One)"}&amp;gt;}Two) works fine (returns 26);&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;One={'A'}&amp;gt;}Two) works fine (returns 10);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;One={"=One=(Max(TOTAL One)-1)"}&amp;gt;}Two) returns 10 if nothing or everything is selected for One but 0 if either A or B is selected. I want the expression to return 0 only if just A is selected, and otherwise 10.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find attached an illustration of my predicament. Any help will be greatly appreciated&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;Ryan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Feb 2014 18:55:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Trouble-with-Dual-Field/m-p/586559#M217651</guid>
      <dc:creator />
      <dc:date>2014-02-28T18:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis Trouble with Dual Field</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Trouble-with-Dual-Field/m-p/586560#M217652</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;The problem is not with dual but with the set expression.&lt;/P&gt;&lt;P&gt;Lets simplify it: =Sum({&amp;lt;One={"=One=1"}&amp;gt;}Two)&lt;/P&gt;&lt;P&gt;With your default selection 'One=B=2' it won't work because there is no '1' in current selections.&lt;/P&gt;&lt;P&gt;You have to use set again to clear the selection and some function that does nothing just applies the set.&lt;/P&gt;&lt;P&gt;=Sum({&amp;lt;One={"=Only({1} One)=1"}&amp;gt;}Two) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Second, the total modifier won't work here it's suitable only for chart dimensions.&lt;/P&gt;&lt;P&gt;But you need somehow to calculate the max total. One possible solution is to use $-sign expansion. QV expands it once before calculating the expression.&lt;/P&gt;&lt;P&gt; =Sum({&amp;lt;One={"=Only({1} One)=$(=Max(One))-1"}&amp;gt;}Two)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Although, you will possibly need the total modifier if decide to use it in some chart.&amp;nbsp; &lt;/P&gt;&lt;P&gt; &lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Feb 2014 19:15:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Trouble-with-Dual-Field/m-p/586560#M217652</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2014-02-28T19:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis Trouble with Dual Field</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Trouble-with-Dual-Field/m-p/586561#M217653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In addition, &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;you can also use:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({&amp;lt;One={'&amp;gt;=$(=max(One)-1)&amp;lt;=$(=max(One)-1)'}&amp;gt;}Two)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Feb 2014 19:22:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Trouble-with-Dual-Field/m-p/586561#M217653</guid>
      <dc:creator>jerem1234</dc:creator>
      <dc:date>2014-02-28T19:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis Trouble with Dual Field</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Trouble-with-Dual-Field/m-p/586562#M217654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just a suggestion. Why don't you use min instead of max for A.&lt;/P&gt;&lt;P&gt;Like,&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Sum({&amp;lt;One={"=One=Min(TOTAL One)"}&amp;gt;}Two)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Feb 2014 19:23:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Trouble-with-Dual-Field/m-p/586562#M217654</guid>
      <dc:creator />
      <dc:date>2014-02-28T19:23:41Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis Trouble with Dual Field</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Trouble-with-Dual-Field/m-p/586563#M217655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for clearing this up for me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Feb 2014 19:37:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Trouble-with-Dual-Field/m-p/586563#M217655</guid>
      <dc:creator />
      <dc:date>2014-02-28T19:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis Trouble with Dual Field</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Trouble-with-Dual-Field/m-p/586564#M217656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's pretty clever. Works like a charm. Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Feb 2014 19:38:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Trouble-with-Dual-Field/m-p/586564#M217656</guid>
      <dc:creator />
      <dc:date>2014-02-28T19:38:55Z</dc:date>
    </item>
  </channel>
</rss>

