<?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: Variable value not taken by chart in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Variable-value-not-taken-by-chart/m-p/2497508#M102756</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/295559"&gt;@DEMONIO_AZUL&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Try using the total qualifier in your avg() expression&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;AverageSales =&amp;nbsp;&lt;/STRONG&gt;Avg(&lt;STRONG&gt;total&lt;/STRONG&gt;&amp;nbsp; expression)&lt;BR /&gt;&lt;BR /&gt;if(sum(Sales)&amp;gt;=$(AverageSales),color1,color2)&lt;BR /&gt;&lt;BR /&gt;- Regards, Matheus&lt;/P&gt;</description>
    <pubDate>Wed, 11 Dec 2024 19:20:15 GMT</pubDate>
    <dc:creator>MatheusC</dc:creator>
    <dc:date>2024-12-11T19:20:15Z</dc:date>
    <item>
      <title>Variable value not taken by chart</title>
      <link>https://community.qlik.com/t5/App-Development/Variable-value-not-taken-by-chart/m-p/2497497#M102752</link>
      <description>&lt;P&gt;Hello there!&lt;BR /&gt;&lt;BR /&gt;I have a bar chart that should look like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DEMONIO_AZUL_0-1733940688742.png" style="width: 794px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/175595i3F88FADA829CB99B/image-dimensions/794x482?v=v2" width="794" height="482" role="button" title="DEMONIO_AZUL_0-1733940688742.png" alt="DEMONIO_AZUL_0-1733940688742.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The average value is stored in a variable defined like this:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;AverageSales =&amp;nbsp;Avg({1&amp;lt;[Full Name]={*}&amp;gt;} Sales)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT color="#666699"&gt;Note: [Full Name] is the name of the dimension I use for each Salesperson.&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;I use it to plot the Add-on Reference line, which has the correct value, 460.77.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DEMONIO_AZUL_0-1733941456736.png" style="width: 517px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/175597i19C2D47D39B4EF07/image-dimensions/517x557?v=v2" width="517" height="557" role="button" title="DEMONIO_AZUL_0-1733941456736.png" alt="DEMONIO_AZUL_0-1733941456736.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To colour the bars, all bars that are above the average must be in green, all the rest are red.&lt;/P&gt;
&lt;P&gt;It works with the numeric value in the Appearance section where I input the value, but it does not work otherwise. The variable does not work, neither the very same expression that defines the variable... but it does work on the Add-on Reference line.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What am I doing wrong?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried all these, but only the numeric value works:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DEMONIO_AZUL_1-1733941116566.png" style="width: 716px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/175596iA61C5C1BD2A748CE/image-dimensions/716x226?v=v2" width="716" height="226" role="button" title="DEMONIO_AZUL_1-1733941116566.png" alt="DEMONIO_AZUL_1-1733941116566.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Any help will be appreciated.&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 18:24:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Variable-value-not-taken-by-chart/m-p/2497497#M102752</guid>
      <dc:creator>DEMONIO_AZUL</dc:creator>
      <dc:date>2024-12-11T18:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: Variable value not taken by chart</title>
      <link>https://community.qlik.com/t5/App-Development/Variable-value-not-taken-by-chart/m-p/2497507#M102755</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/295559"&gt;@DEMONIO_AZUL&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;since your are ignoring selections in your Set Analysis anyways. You could also just calculate the average in the script beforehand and store it into a variable.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Avg_Table:
LOAD
    Avg(Sales) AS AverageSales
RESIDENT Sales_Table;

// Store the average in a variable
LET vAverageSales = Peek('AverageSales');

Drop table Avg_Table;&lt;/LI-CODE&gt;
&lt;P&gt;Then your can just use your average $(vAverageSales) in the color expression.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Noah&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 19:15:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Variable-value-not-taken-by-chart/m-p/2497507#M102755</guid>
      <dc:creator>NoahF</dc:creator>
      <dc:date>2024-12-11T19:15:23Z</dc:date>
    </item>
    <item>
      <title>Re: Variable value not taken by chart</title>
      <link>https://community.qlik.com/t5/App-Development/Variable-value-not-taken-by-chart/m-p/2497508#M102756</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/295559"&gt;@DEMONIO_AZUL&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Try using the total qualifier in your avg() expression&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;AverageSales =&amp;nbsp;&lt;/STRONG&gt;Avg(&lt;STRONG&gt;total&lt;/STRONG&gt;&amp;nbsp; expression)&lt;BR /&gt;&lt;BR /&gt;if(sum(Sales)&amp;gt;=$(AverageSales),color1,color2)&lt;BR /&gt;&lt;BR /&gt;- Regards, Matheus&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 19:20:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Variable-value-not-taken-by-chart/m-p/2497508#M102756</guid>
      <dc:creator>MatheusC</dc:creator>
      <dc:date>2024-12-11T19:20:15Z</dc:date>
    </item>
    <item>
      <title>Re: Variable value not taken by chart</title>
      <link>https://community.qlik.com/t5/App-Development/Variable-value-not-taken-by-chart/m-p/2498349#M102869</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/149113"&gt;@MatheusC&lt;/a&gt;&amp;nbsp;. This was useful. The expression as you posted it was not working either, but this, with your idea, did the trick:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DEMONIO_AZUL_0-1734446865829.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/175790i6B17030205A68A9B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DEMONIO_AZUL_0-1734446865829.png" alt="DEMONIO_AZUL_0-1734446865829.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2024 14:48:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Variable-value-not-taken-by-chart/m-p/2498349#M102869</guid>
      <dc:creator>DEMONIO_AZUL</dc:creator>
      <dc:date>2024-12-17T14:48:29Z</dc:date>
    </item>
  </channel>
</rss>

