<?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 Histogram with a Calculated Dimension in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Histogram-with-a-Calculated-Dimension/m-p/2091619#M89477</link>
    <description>&lt;P&gt;Hello dears!&lt;/P&gt;
&lt;P&gt;Hope everything is well.&lt;/P&gt;
&lt;P&gt;I have an application in which I present a key-performance indicator that tells me a calculated "Accuracy" for each element in my database called "Pair".&lt;/P&gt;
&lt;P&gt;This accuracy is calculated as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="100%"&gt;Avg (&lt;BR /&gt;&lt;BR /&gt;Aggr (&lt;BR /&gt;&lt;BR /&gt;If ( Alt ( Sum (distinct [Demanded Qty] ), 0 ) = Alt ( Sum (distinct [Forecast Qty] ), 0 ), 100,&lt;BR /&gt;If ( Alt ( Sum (distinct [Demanded Qty] ), 0 ) = 0 and Alt ( Sum (distinct [Forecast Qty] ), 0 ) &amp;lt;&amp;gt; 0, 0,&lt;BR /&gt;If ( Alt ( Sum (distinct [Demanded Qty] ), 0 ) &amp;lt;&amp;gt; 0 and Alt ( Sum (distinct [Forecast Qty] ), 0 ) = 0, 0,&lt;BR /&gt;&lt;BR /&gt;100 -&lt;BR /&gt;If ( Alt ( Sum (distinct [Demanded Qty] ), 0 ) &amp;gt; Alt ( Sum (distinct [Forecast Qty] ), 0 ), ( Fabs ( Alt ( Sum (distinct [Demanded Qty] ), 0 ) - Alt ( Sum (distinct [Forecast Qty] ), 0 ) ) ) / Alt ( Sum (distinct [Demanded Qty] ), 0 ) * 100,&lt;BR /&gt;&lt;BR /&gt;If ( Alt ( Sum (distinct [Forecast Qty] ), 0 ) &amp;gt; Alt ( Sum (distinct [Demanded Qty] ), 0 ), ( Fabs ( Alt ( Sum (distinct [Demanded Qty] ), 0 ) - Alt ( Sum (distinct [Forecast Qty] ), 0 ) ) ) / Alt ( Sum (distinct [Forecast Qty] ), 0 ) * 100&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;, [%Pair] )&lt;BR /&gt;&lt;BR /&gt;)&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This expression returns me a number between 0 and 100 for each Pair, and I aggregate them as Average for overall value:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="valeling_1-1688740460861.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/111785i1DE62D3C90EE950D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="valeling_1-1688740460861.png" alt="valeling_1-1688740460861.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I would like to create an Histogram counting how many Pairs are with a determined Accuracy, whether with a Class() or not.&lt;BR /&gt;I created a bar chart with the following settings:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Dimension&lt;/STRONG&gt;:&amp;nbsp;The same as highlighted above.&lt;BR /&gt;&lt;STRONG&gt;Expression&lt;/STRONG&gt;: count (%Pair)&lt;/P&gt;
&lt;P&gt;The chart fails with an error in calculated Dimension:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="valeling_2-1688740839811.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/111786iA5B4D9217C26FAD5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="valeling_2-1688740839811.png" alt="valeling_2-1688740839811.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can't calculate this expression previously in script because this Accuracy should recalculate respecting time frame filters.&lt;/P&gt;
&lt;P&gt;Any ideas on how can I make this Histogram as I described?&lt;/P&gt;
&lt;P&gt;Thank you in advance!&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jul 2023 15:53:37 GMT</pubDate>
    <dc:creator>paulinhok14</dc:creator>
    <dc:date>2023-07-07T15:53:37Z</dc:date>
    <item>
      <title>Histogram with a Calculated Dimension</title>
      <link>https://community.qlik.com/t5/App-Development/Histogram-with-a-Calculated-Dimension/m-p/2091619#M89477</link>
      <description>&lt;P&gt;Hello dears!&lt;/P&gt;
&lt;P&gt;Hope everything is well.&lt;/P&gt;
&lt;P&gt;I have an application in which I present a key-performance indicator that tells me a calculated "Accuracy" for each element in my database called "Pair".&lt;/P&gt;
&lt;P&gt;This accuracy is calculated as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="100%"&gt;Avg (&lt;BR /&gt;&lt;BR /&gt;Aggr (&lt;BR /&gt;&lt;BR /&gt;If ( Alt ( Sum (distinct [Demanded Qty] ), 0 ) = Alt ( Sum (distinct [Forecast Qty] ), 0 ), 100,&lt;BR /&gt;If ( Alt ( Sum (distinct [Demanded Qty] ), 0 ) = 0 and Alt ( Sum (distinct [Forecast Qty] ), 0 ) &amp;lt;&amp;gt; 0, 0,&lt;BR /&gt;If ( Alt ( Sum (distinct [Demanded Qty] ), 0 ) &amp;lt;&amp;gt; 0 and Alt ( Sum (distinct [Forecast Qty] ), 0 ) = 0, 0,&lt;BR /&gt;&lt;BR /&gt;100 -&lt;BR /&gt;If ( Alt ( Sum (distinct [Demanded Qty] ), 0 ) &amp;gt; Alt ( Sum (distinct [Forecast Qty] ), 0 ), ( Fabs ( Alt ( Sum (distinct [Demanded Qty] ), 0 ) - Alt ( Sum (distinct [Forecast Qty] ), 0 ) ) ) / Alt ( Sum (distinct [Demanded Qty] ), 0 ) * 100,&lt;BR /&gt;&lt;BR /&gt;If ( Alt ( Sum (distinct [Forecast Qty] ), 0 ) &amp;gt; Alt ( Sum (distinct [Demanded Qty] ), 0 ), ( Fabs ( Alt ( Sum (distinct [Demanded Qty] ), 0 ) - Alt ( Sum (distinct [Forecast Qty] ), 0 ) ) ) / Alt ( Sum (distinct [Forecast Qty] ), 0 ) * 100&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;, [%Pair] )&lt;BR /&gt;&lt;BR /&gt;)&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This expression returns me a number between 0 and 100 for each Pair, and I aggregate them as Average for overall value:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="valeling_1-1688740460861.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/111785i1DE62D3C90EE950D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="valeling_1-1688740460861.png" alt="valeling_1-1688740460861.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I would like to create an Histogram counting how many Pairs are with a determined Accuracy, whether with a Class() or not.&lt;BR /&gt;I created a bar chart with the following settings:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Dimension&lt;/STRONG&gt;:&amp;nbsp;The same as highlighted above.&lt;BR /&gt;&lt;STRONG&gt;Expression&lt;/STRONG&gt;: count (%Pair)&lt;/P&gt;
&lt;P&gt;The chart fails with an error in calculated Dimension:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="valeling_2-1688740839811.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/111786iA5B4D9217C26FAD5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="valeling_2-1688740839811.png" alt="valeling_2-1688740839811.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can't calculate this expression previously in script because this Accuracy should recalculate respecting time frame filters.&lt;/P&gt;
&lt;P&gt;Any ideas on how can I make this Histogram as I described?&lt;/P&gt;
&lt;P&gt;Thank you in advance!&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2023 15:53:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Histogram-with-a-Calculated-Dimension/m-p/2091619#M89477</guid>
      <dc:creator>paulinhok14</dc:creator>
      <dc:date>2023-07-07T15:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: Histogram with a Calculated Dimension</title>
      <link>https://community.qlik.com/t5/App-Development/Histogram-with-a-Calculated-Dimension/m-p/2091634#M89479</link>
      <description>&lt;P&gt;Hi there!&lt;/P&gt;
&lt;P&gt;I wish you could attend my lecture on Set Analysis and AGGR at the &lt;A href="https://masterssummit.com" target="_blank" rel="noopener"&gt;Masters Summit for Qlik&lt;/A&gt; - in one of my examples, I'm teaching just that - how to build a Histogram with an aggregated expression. Check out our schedule this fall, maybe you can join...&lt;/P&gt;
&lt;P&gt;In a nutshell - a calculated dimension requires an array of values. The AGGR() function generates an array, but then the Avg() turns it into a single number. For your needs, you should drop the Avg() and leave the AGGR().&lt;/P&gt;
&lt;P&gt;In order to get a bar chart with a reasonable number of bars, perhaps you want to round the results of AGGR() to the desired level. For example, rounding to 10 will give you 10 bars in your chart.&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2023 16:43:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Histogram-with-a-Calculated-Dimension/m-p/2091634#M89479</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2023-07-07T16:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: Histogram with a Calculated Dimension</title>
      <link>https://community.qlik.com/t5/App-Development/Histogram-with-a-Calculated-Dimension/m-p/2092582#M89554</link>
      <description>&lt;P&gt;Hey Oleg, thanks for your answer!&lt;BR /&gt;&lt;BR /&gt;Not even knowing what you kindly said: &lt;EM&gt;"&lt;/EM&gt;&lt;SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;a calculated dimension requires an array of values. The AGGR() function generates an array, but then the Avg() turns it into a single number"&lt;/EM&gt;&lt;/STRONG&gt;, I've just managed to reach the solution removing Avg() from dimension.&lt;BR /&gt;&lt;BR /&gt;And now reading your comment, everything makes sense. I appreciate, thank you for making it clear!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2023 12:51:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Histogram-with-a-Calculated-Dimension/m-p/2092582#M89554</guid>
      <dc:creator>paulinhok14</dc:creator>
      <dc:date>2023-07-11T12:51:19Z</dc:date>
    </item>
  </channel>
</rss>

