<?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: Comparative Analysis - Apply Filters to Two Groups (Alternate States) in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Comparative-Analysis-Apply-Filters-to-Two-Groups-Alternate/m-p/472170#M176323</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If your fields keep changing without warning you're in for a world of pain.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could put all your article fields into a multibox and use the default state for the multibox. If your chart is also set to use the default state then selections in those fields will be applied to your chart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should probably create a new field (called FieldList for example) that contains the names of all the fields you wish to choose from for comparison of the two groups. You could add this at the end of your script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for ii=0 to NoOfTables()-1&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; for jj=0 to NoOfFields(TableName($(ii)) )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FieldListTable:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOAD FieldName($(jj),TableName($(ii))) as FieldList&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Autogenerate 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; next&lt;/P&gt;&lt;P&gt;next&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will create a table called FieldListTable with a field FieldList that will contain the fields of your document (excluding itself). You can then a a listbox for FieldList so you can select fieldnames for the comparison. Next you use expressions like below to tie the selected fields to an alternative state (Group 1 in the example below).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({$&amp;lt; $(=Concat( distinct '[' &amp;amp; FieldList &amp;amp; ']=[Group 1]::[' &amp;amp; FieldList &amp;amp; ']',',' )) &amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You'll still have to create listboxes or multiboxes per group for the fields to be able to make selections. I've explored one limited way to populate multiboxes dynamically. It's not perfect, field names with spaces can't be used for example. Perhaps a macro based solution is a better option.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 30 Dec 2012 20:37:29 GMT</pubDate>
    <dc:creator>Gysbert_Wassenaar</dc:creator>
    <dc:date>2012-12-30T20:37:29Z</dc:date>
    <item>
      <title>Comparative Analysis - Apply Filters to Two Groups (Alternate States)</title>
      <link>https://community.qlik.com/t5/QlikView/Comparative-Analysis-Apply-Filters-to-Two-Groups-Alternate/m-p/472165#M176318</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello to everybody&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I defined two &lt;EM&gt;Alternate States&lt;/EM&gt; (Group 1 and Group 2). &lt;/P&gt;&lt;P&gt;Thanks to comparate analysis function I am able to set different filters for Group 1 and Group 2. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;QUESTION: &lt;/STRONG&gt;Is it possible to define some listboxes (or even multiboxes), which apply / affect both Groups? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my case, I have three tables&lt;/P&gt;&lt;P&gt;- Customers (Name, Gender, Age, ...)&lt;/P&gt;&lt;P&gt;- Articles (Category, Colour, ...)&lt;/P&gt;&lt;P&gt;- Sales (combines customers and articles) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to compare two different customer-groups in one chart. As I have written above; I am able to manage this. But as soon as I set filters to the article attributes, I have to do this twice for both groups (it should automaticlly affect both groups). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a solution? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot in advance&lt;/P&gt;&lt;P&gt;Luc&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 Dec 2012 00:04:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Comparative-Analysis-Apply-Filters-to-Two-Groups-Alternate/m-p/472165#M176318</guid>
      <dc:creator />
      <dc:date>2012-12-30T00:04:45Z</dc:date>
    </item>
    <item>
      <title>Re: Comparative Analysis - Apply Filters to Two Groups (Alternate States)</title>
      <link>https://community.qlik.com/t5/QlikView/Comparative-Analysis-Apply-Filters-to-Two-Groups-Alternate/m-p/472166#M176319</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use set analysis expressions to specify which states apply to which fields. See attached example. It contains two alternate states Group 1 and Group 2. The field Year is set per state. In the top charts the selections in Product are not used. In the lower charts the selections in Product are applied to all charts, regardless of state.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 Dec 2012 08:52:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Comparative-Analysis-Apply-Filters-to-Two-Groups-Alternate/m-p/472166#M176319</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2012-12-30T08:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: Comparative Analysis - Apply Filters to Two Groups (Alternate States)</title>
      <link>https://community.qlik.com/t5/QlikView/Comparative-Analysis-Apply-Filters-to-Two-Groups-Alternate/m-p/472167#M176320</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gysbert Wassenaar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for your answer. That works fine. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to apply the same mechanism even to whole MULTIBOXES (and not only to the attribute product, which is listed manually in the expression)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Luc&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 Dec 2012 13:43:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Comparative-Analysis-Apply-Filters-to-Two-Groups-Alternate/m-p/472167#M176320</guid>
      <dc:creator />
      <dc:date>2012-12-30T13:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: Comparative Analysis - Apply Filters to Two Groups (Alternate States)</title>
      <link>https://community.qlik.com/t5/QlikView/Comparative-Analysis-Apply-Filters-to-Two-Groups-Alternate/m-p/472168#M176321</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you have only a few fields which should 'listen' to states then don't assign states to the charts. Only use the states in the expressions for those few fields. Instead of &lt;STRONG&gt;sum({[Group 1]&amp;lt;Product=$::Product&amp;gt;}Sales)&lt;/STRONG&gt; you would use expressions like &lt;STRONG&gt;sum({&amp;lt;Year=[Group 1]::Year&amp;gt;}Sales)&lt;/STRONG&gt;. You then only specify the state for the fields that should 'listen' to that specific state. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So you could add all the fields in your multibox with $::&lt;EM&gt;fieldname &lt;/EM&gt;to assign them the default state or you can turn it around and use &lt;EM&gt;[GroupName]::fieldname &lt;/EM&gt;to assign the fields that should not use the default state to the alternate state of your choice.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 Dec 2012 13:58:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Comparative-Analysis-Apply-Filters-to-Two-Groups-Alternate/m-p/472168#M176321</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2012-12-30T13:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: Comparative Analysis - Apply Filters to Two Groups (Alternate States)</title>
      <link>https://community.qlik.com/t5/QlikView/Comparative-Analysis-Apply-Filters-to-Two-Groups-Alternate/m-p/472169#M176322</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gysbert&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for the fast reply. I have the following situation&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Table Customers has 82 fields&lt;/LI&gt;&lt;LI&gt;Table Articles has 38 fields&lt;/LI&gt;&lt;LI&gt;The number of the fields and their names can change over time (I will set up different projects which use a very similar data cockpit but the fields and their names can be slightly different from project to project)&lt;/LI&gt;&lt;LI&gt;I would like to compare two customer groups (e.g. male, 30-40years old, low income vs. male, 40-50years old, high income)&lt;/LI&gt;&lt;LI&gt;The filters for articles should apply to both groups&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Due to the high number of fields and their 'instability' over time it is not very handy to hardcode the names of the fields in the expression statements. It would be a lot easier if I could add them to a multibox...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Luc&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 Dec 2012 14:11:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Comparative-Analysis-Apply-Filters-to-Two-Groups-Alternate/m-p/472169#M176322</guid>
      <dc:creator />
      <dc:date>2012-12-30T14:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: Comparative Analysis - Apply Filters to Two Groups (Alternate States)</title>
      <link>https://community.qlik.com/t5/QlikView/Comparative-Analysis-Apply-Filters-to-Two-Groups-Alternate/m-p/472170#M176323</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If your fields keep changing without warning you're in for a world of pain.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could put all your article fields into a multibox and use the default state for the multibox. If your chart is also set to use the default state then selections in those fields will be applied to your chart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should probably create a new field (called FieldList for example) that contains the names of all the fields you wish to choose from for comparison of the two groups. You could add this at the end of your script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for ii=0 to NoOfTables()-1&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; for jj=0 to NoOfFields(TableName($(ii)) )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FieldListTable:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOAD FieldName($(jj),TableName($(ii))) as FieldList&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Autogenerate 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; next&lt;/P&gt;&lt;P&gt;next&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will create a table called FieldListTable with a field FieldList that will contain the fields of your document (excluding itself). You can then a a listbox for FieldList so you can select fieldnames for the comparison. Next you use expressions like below to tie the selected fields to an alternative state (Group 1 in the example below).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({$&amp;lt; $(=Concat( distinct '[' &amp;amp; FieldList &amp;amp; ']=[Group 1]::[' &amp;amp; FieldList &amp;amp; ']',',' )) &amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You'll still have to create listboxes or multiboxes per group for the fields to be able to make selections. I've explored one limited way to populate multiboxes dynamically. It's not perfect, field names with spaces can't be used for example. Perhaps a macro based solution is a better option.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 Dec 2012 20:37:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Comparative-Analysis-Apply-Filters-to-Two-Groups-Alternate/m-p/472170#M176323</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2012-12-30T20:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: Comparative Analysis - Apply Filters to Two Groups (Alternate States)</title>
      <link>https://community.qlik.com/t5/QlikView/Comparative-Analysis-Apply-Filters-to-Two-Groups-Alternate/m-p/472171#M176324</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks for this..very helpful..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Aug 2013 01:41:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Comparative-Analysis-Apply-Filters-to-Two-Groups-Alternate/m-p/472171#M176324</guid>
      <dc:creator>rotero</dc:creator>
      <dc:date>2013-08-01T01:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: Comparative Analysis - Apply Filters to Two Groups (Alternate States)</title>
      <link>https://community.qlik.com/t5/QlikView/Comparative-Analysis-Apply-Filters-to-Two-Groups-Alternate/m-p/472172#M176325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Team&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; i am using the following syntax for set analytics, it is not working fine. kindly let me know the correct syntax.But the values are not matching with the back end. &lt;/P&gt;&lt;P&gt;sum({&amp;lt;CUSTID-={"[ALP]::CUSTID}"&amp;gt;}TOTALSALE)&lt;/P&gt;&lt;P&gt; &lt;BR /&gt;Desc&lt;/P&gt;&lt;P&gt;[ALP] is one group&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Oct 2014 10:51:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Comparative-Analysis-Apply-Filters-to-Two-Groups-Alternate/m-p/472172#M176325</guid>
      <dc:creator />
      <dc:date>2014-10-10T10:51:06Z</dc:date>
    </item>
  </channel>
</rss>

