<?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: Solution to Change calculation per field selection in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Solution-to-Change-calculation-per-field-selection/m-p/1853881#M70499</link>
    <description>&lt;P&gt;Hey everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Seems that i found a solution. Don't know if it would be the best in terms of performance, but here it is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. &lt;STRONG&gt;Create a Island Table with the values that we need to provide for the user selections&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Island_table:&lt;BR /&gt;LOAD * Inline &lt;BR /&gt;[&lt;BR /&gt;Interaction Type&lt;BR /&gt;Interaction&lt;BR /&gt;InteractionAggr&lt;BR /&gt;InteractionAvg&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;2. &lt;STRONG&gt;Create a variable that looks at the selection done by the user&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;$(vTeste1)&lt;/P&gt;
&lt;P&gt;=if(GetFieldSelections([Interaction Type])='Interaction', 'Interaction',&lt;BR /&gt;if(GetFieldSelections([Interaction Type])='InteractionAggr', 'InteractionAggr', 'InteractionAvg'))&lt;/P&gt;
&lt;P&gt;3.&lt;STRONG&gt;Have a general calculation&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Sum( [$(vTeste1)] )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have a nice weekend!&lt;/P&gt;</description>
    <pubDate>Sat, 30 Oct 2021 19:01:59 GMT</pubDate>
    <dc:creator>50ShadesOfSalty</dc:creator>
    <dc:date>2021-10-30T19:01:59Z</dc:date>
    <item>
      <title>Solution to Change calculation per field selection</title>
      <link>https://community.qlik.com/t5/App-Development/Solution-to-Change-calculation-per-field-selection/m-p/1853877#M70496</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Seeking guidance and help on the best performance solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Problem: Using a filter panel to change the calculation on charts&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Imagine that I need to have a [field] (not available in the DataModel of the Application) with the following values:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Interaction&lt;/LI&gt;
&lt;LI&gt;InteractionAggr&lt;/LI&gt;
&lt;LI&gt;InteractionAvg&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This field needs to be available in a Filter Panel visualization. Once the user switch between different values, the charts need to update their calculations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My idea would be to have a general calculation that is going to change the measure taking into account the [Field] selection, for example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sum( {&amp;lt;Set Analysis&amp;gt;} [$(vMeasureToChange)] )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then, depending on the user selection, the calculation would be as the following:&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;[field] = 'Interaction'
&lt;UL&gt;
&lt;LI&gt;Sum( {&amp;lt;Set Analysis&amp;gt;} [Interaction] )&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;[field] = 'InteractionAggr'
&lt;UL&gt;
&lt;LI&gt;Sum( {&amp;lt;Set Analysis&amp;gt;} [InteractionAggr] )&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;[field] = 'InteractionAvg'
&lt;UL&gt;
&lt;LI&gt;Sum( {&amp;lt;Set Analysis&amp;gt;} [InteractionAvg] )&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this way, i would avoid performance issues with If's and picks in the front-end.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;However, i need guidance on how to do this.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it possible to work only in the front-end + variables? This would be the perfect scenario taking into account Environment limitations that we have at this moment. Tried to use &lt;STRONG&gt;valuelist()&lt;/STRONG&gt; function in the Filter Panel visualization, but it does not allow any value to be selected in the DataModel, as long as it is a &lt;EM&gt;synthetic dimension&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;Do i need to work in the Script in order to make this behaviour work? If so, what's the guidance?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for the help and guidance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Oct 2021 18:19:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Solution-to-Change-calculation-per-field-selection/m-p/1853877#M70496</guid>
      <dc:creator>50ShadesOfSalty</dc:creator>
      <dc:date>2021-10-30T18:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: Solution to Change calculation per field selection</title>
      <link>https://community.qlik.com/t5/App-Development/Solution-to-Change-calculation-per-field-selection/m-p/1853878#M70497</link>
      <description>&lt;P&gt;You could try this:&lt;/P&gt;
&lt;P&gt;Sum( {&amp;lt;Set Analysis&amp;gt;} [$(=(Maxstring(field)))] )&lt;/P&gt;</description>
      <pubDate>Sat, 30 Oct 2021 18:45:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Solution-to-Change-calculation-per-field-selection/m-p/1853878#M70497</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2021-10-30T18:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: Solution to Change calculation per field selection</title>
      <link>https://community.qlik.com/t5/App-Development/Solution-to-Change-calculation-per-field-selection/m-p/1853881#M70499</link>
      <description>&lt;P&gt;Hey everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Seems that i found a solution. Don't know if it would be the best in terms of performance, but here it is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. &lt;STRONG&gt;Create a Island Table with the values that we need to provide for the user selections&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Island_table:&lt;BR /&gt;LOAD * Inline &lt;BR /&gt;[&lt;BR /&gt;Interaction Type&lt;BR /&gt;Interaction&lt;BR /&gt;InteractionAggr&lt;BR /&gt;InteractionAvg&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;2. &lt;STRONG&gt;Create a variable that looks at the selection done by the user&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;$(vTeste1)&lt;/P&gt;
&lt;P&gt;=if(GetFieldSelections([Interaction Type])='Interaction', 'Interaction',&lt;BR /&gt;if(GetFieldSelections([Interaction Type])='InteractionAggr', 'InteractionAggr', 'InteractionAvg'))&lt;/P&gt;
&lt;P&gt;3.&lt;STRONG&gt;Have a general calculation&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Sum( [$(vTeste1)] )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have a nice weekend!&lt;/P&gt;</description>
      <pubDate>Sat, 30 Oct 2021 19:01:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Solution-to-Change-calculation-per-field-selection/m-p/1853881#M70499</guid>
      <dc:creator>50ShadesOfSalty</dc:creator>
      <dc:date>2021-10-30T19:01:59Z</dc:date>
    </item>
  </channel>
</rss>

