<?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 Error in Calculated Dimension in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Error-in-Calculated-Dimension/m-p/405601#M558702</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to create a pie chart using a calculated dimension to bucket calculated results.&amp;nbsp; More specifically, I'm using a percentage difference caluclation to make quality evaluations, and I would like to show how many instances fall within each category.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ideally, I'd write my dimension equation like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;=if( (Avg(x) - Avg(y)) / Avg(x) &amp;lt; -0.25, 'Bad',&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( (Avg(x) - Avg(y)) / Avg(x) &amp;gt; 0.25, 'Good', 'OK'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then my expression [Count(Key)] would simply distribute the instances across my calculated categories.&amp;nbsp; When I try this out, however, I get &lt;STRONG&gt;// Error in calculated dimension&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've read across the internet that I need to use the aggr() function to accomplish this, but I can't seem to figure out how to implement it in this situation.&amp;nbsp; Any examples I've looked at don't seem to fit my situation.&amp;nbsp;&amp;nbsp; There are around 15 different fields on my page the user can select to change the values of &lt;STRONG&gt;x&lt;/STRONG&gt; and &lt;STRONG&gt;y&lt;/STRONG&gt;, and those should all be reflected in the equation above.&amp;nbsp; So is aggr() right for me?&amp;nbsp; Do I need to list all those fields in the aggr() function?&amp;nbsp; Am I even barking up the right tree?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 May 2013 13:12:00 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-05-24T13:12:00Z</dc:date>
    <item>
      <title>Error in Calculated Dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Error-in-Calculated-Dimension/m-p/405601#M558702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to create a pie chart using a calculated dimension to bucket calculated results.&amp;nbsp; More specifically, I'm using a percentage difference caluclation to make quality evaluations, and I would like to show how many instances fall within each category.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ideally, I'd write my dimension equation like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;=if( (Avg(x) - Avg(y)) / Avg(x) &amp;lt; -0.25, 'Bad',&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( (Avg(x) - Avg(y)) / Avg(x) &amp;gt; 0.25, 'Good', 'OK'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then my expression [Count(Key)] would simply distribute the instances across my calculated categories.&amp;nbsp; When I try this out, however, I get &lt;STRONG&gt;// Error in calculated dimension&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've read across the internet that I need to use the aggr() function to accomplish this, but I can't seem to figure out how to implement it in this situation.&amp;nbsp; Any examples I've looked at don't seem to fit my situation.&amp;nbsp;&amp;nbsp; There are around 15 different fields on my page the user can select to change the values of &lt;STRONG&gt;x&lt;/STRONG&gt; and &lt;STRONG&gt;y&lt;/STRONG&gt;, and those should all be reflected in the equation above.&amp;nbsp; So is aggr() right for me?&amp;nbsp; Do I need to list all those fields in the aggr() function?&amp;nbsp; Am I even barking up the right tree?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 May 2013 13:12:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Error-in-Calculated-Dimension/m-p/405601#M558702</guid>
      <dc:creator />
      <dc:date>2013-05-24T13:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Calculated Dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Error-in-Calculated-Dimension/m-p/405602#M558703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you're right that you need the aggr function. Without it you get only one number back from avg(x). I don't know what should go in your buckets. It could be products or salesmen or months etc. Try starting with Key and see if that gives you the result you need. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;=aggr(if( (Avg(x) - Avg(y)) / Avg(x) &amp;lt; -0.25, 'Bad',&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( (Avg(x) - Avg(y)) / Avg(x) &amp;gt; 0.25, 'Good', 'OK'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; ),Key)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;Selections in other fields will still influence which x and y values are used in the calculation..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 May 2013 13:23:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Error-in-Calculated-Dimension/m-p/405602#M558703</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-05-24T13:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Calculated Dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Error-in-Calculated-Dimension/m-p/405603#M558704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the quick response.&amp;nbsp; Turns out that I wasn't thinking about the equation very Qlikview-y.&amp;nbsp; Avg(x) is the average price of each product, so &lt;STRONG&gt;aggr(Avg([Price]),[Product]) &lt;/STRONG&gt;returned the results I'm looking for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Even though that returns the proper number, the chart still isn't what I need...&amp;nbsp; It seems that my expression &lt;STRONG&gt;Count(Key)&lt;/STRONG&gt; is placing the same number of instances within each bucket.&amp;nbsp; In other words, the categories 'Good', 'Bad', and 'OK' all have 100 items in them, which is equal to the total population.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a trick to dispersing these within each bucket?&amp;nbsp; I assumed that just counting the total in the expression would split them by my category.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 May 2013 13:39:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Error-in-Calculated-Dimension/m-p/405603#M558704</guid>
      <dc:creator />
      <dc:date>2013-05-24T13:39:49Z</dc:date>
    </item>
  </channel>
</rss>

