<?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: Formula in Calculated Dimension in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Formula-in-Calculated-Dimension/m-p/774843#M1044613</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you can do this using something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Aggr(If(Sum(Stock_Qty) &amp;gt; 0 And Sum(Stock_Qty) &amp;gt; ($(VMonths) * &lt;STRONG&gt;Sum&lt;/STRONG&gt;(AvrgSales)), Sum(Stock_Qty) - ($(VMonths) * &lt;STRONG&gt;Sum&lt;/STRONG&gt;(AvrgSales))), itemName, [exp date])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But this will make a very ugly dimension, so you might want to group them using a Class() function. Like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Class(Sum(Aggr(If(Sum(Stock_Qty) &amp;gt; 0 And Sum(Stock_Qty) &amp;gt; ($(VMonths) * Sum(AvrgSales)), Sum(Stock_Qty) - ($(VMonths) * Sum(AvrgSales))), itemName, [exp date])) ,&lt;STRONG&gt;100&lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(adjust the class size (100 in the example) acccording to your needs and change the field name(s) to the correct ones for your document)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 04 Dec 2014 13:51:28 GMT</pubDate>
    <dc:creator>jonathandienst</dc:creator>
    <dc:date>2014-12-04T13:51:28Z</dc:date>
    <item>
      <title>Formula in Calculated Dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Formula-in-Calculated-Dimension/m-p/774835#M1044605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Experts,&lt;/P&gt;&lt;P&gt;I am using the below formula in the calculated dimension of a pivot table and getting "// Error in calculated dimension"&lt;/P&gt;&lt;P&gt;"if(sum(Stock_Qty)&amp;gt;0,If((sum(Stock_Qty)/AvrgSales)&amp;gt;$(VMonths),sum(Stock_Qty) - ($(VMonths) * AvrgSales),))"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 13:03:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Formula-in-Calculated-Dimension/m-p/774835#M1044605</guid>
      <dc:creator />
      <dc:date>2014-12-04T13:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: Formula in Calculated Dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Formula-in-Calculated-Dimension/m-p/774836#M1044606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You cannot use a sum without aggr condition in a dimension because a sum or a min, max ... function must be executed according to a dimension, a set of fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you use Aggr(Sum(...), myField1, myFieldn) is like summing with&amp;nbsp; myField1, ... myFieldn as dimension&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 13:07:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Formula-in-Calculated-Dimension/m-p/774836#M1044606</guid>
      <dc:creator>alexandros17</dc:creator>
      <dc:date>2014-12-04T13:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: Formula in Calculated Dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Formula-in-Calculated-Dimension/m-p/774837#M1044607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It helps but can you please explain more about the aggregate function and its use?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 13:16:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Formula-in-Calculated-Dimension/m-p/774837#M1044607</guid>
      <dc:creator />
      <dc:date>2014-12-04T13:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: Formula in Calculated Dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Formula-in-Calculated-Dimension/m-p/774838#M1044608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Aggr works like a group by in a sql query, so your sum(...) must be grouped by something if used as dimension.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... But why using it as a dimension, wouldn't be better to use as an expression computed according time, customer, city or something else?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 13:26:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Formula-in-Calculated-Dimension/m-p/774838#M1044608</guid>
      <dc:creator>alexandros17</dc:creator>
      <dc:date>2014-12-04T13:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Formula in Calculated Dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Formula-in-Calculated-Dimension/m-p/774839#M1044609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a table containing item and expiry date as dimensions.&lt;/P&gt;&lt;P&gt;I want to compute the overstock by item.&lt;/P&gt;&lt;P&gt;If I calculate in the expression it will calculate according to the exp date which I don't want.&lt;/P&gt;&lt;P&gt;So I want to use it as dimension to have itemName as dimension 1 OverStock(the calculated dimension) as dimension 2 then exp date as dimension 3.&lt;/P&gt;&lt;P&gt;Using &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.7272720336914px;"&gt;"if(sum(Stock_Qty)&amp;gt;0,If((sum(Stock_Qty)/AvrgSales)&amp;gt;$(VMonths),sum(Stock_Qty) - ($(VMonths) * AvrgSales),))" I want to do the below:&lt;/SPAN&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;if &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.7272720336914px;"&gt;Stock_Qty &amp;gt;0 &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.7272720336914px;"&gt;if (sum(Stock_Qty)/AvrgSales)&amp;gt;$(VMonths)&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.7272720336914px;"&gt;if both conditions are satisfied I want to calculate :sum(Stock_Qty) - ($(VMonths) * AvrgSales) by itemName&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.7272720336914px;"&gt;I tried "&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;=if(sum(Stock_Qty)&amp;gt;0,&lt;/P&gt;&lt;P&gt;If((sum(Stock_Qty)/AvrgSales)&amp;gt;$(VMonths),&lt;/P&gt;&lt;P&gt;aggr(sum(Stock_Qty) - ($(VMonths) * AvrgSales),ItemName),))&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.7272720336914px;"&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.7272720336914px;"&gt;But still getting the same error.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please tell me where exactly and how to use aggr function? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 13:39:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Formula-in-Calculated-Dimension/m-p/774839#M1044609</guid>
      <dc:creator />
      <dc:date>2014-12-04T13:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: Formula in Calculated Dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Formula-in-Calculated-Dimension/m-p/774840#M1044610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;AvrgSales a field? If so, does it have only one possible value in the dimension? If not, you will need to use an aggregation function (sum, avg, max...) to get a single possible value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;You may also need to start with Aggr() as mentioned above.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem may also be caused by the expansion of &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;VMonths. How is this variable defined?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You also have a stray , near the end of the expression. Is that a typo?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 13:39:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Formula-in-Calculated-Dimension/m-p/774840#M1044610</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2014-12-04T13:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: Formula in Calculated Dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Formula-in-Calculated-Dimension/m-p/774841#M1044611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is the field used as a key to compute Sum(Stock_qty)? that field must be added at the end of Aggr in this way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Aggr(Sum(..), thatField)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let meknow&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 13:45:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Formula-in-Calculated-Dimension/m-p/774841#M1044611</guid>
      <dc:creator>alexandros17</dc:creator>
      <dc:date>2014-12-04T13:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: Formula in Calculated Dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Formula-in-Calculated-Dimension/m-p/774842#M1044612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ItemName is the field used.&lt;/P&gt;&lt;P&gt;In my formula I am using sum many times with each sum I have to use aggr()?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 13:48:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Formula-in-Calculated-Dimension/m-p/774842#M1044612</guid>
      <dc:creator />
      <dc:date>2014-12-04T13:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: Formula in Calculated Dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Formula-in-Calculated-Dimension/m-p/774843#M1044613</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you can do this using something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Aggr(If(Sum(Stock_Qty) &amp;gt; 0 And Sum(Stock_Qty) &amp;gt; ($(VMonths) * &lt;STRONG&gt;Sum&lt;/STRONG&gt;(AvrgSales)), Sum(Stock_Qty) - ($(VMonths) * &lt;STRONG&gt;Sum&lt;/STRONG&gt;(AvrgSales))), itemName, [exp date])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But this will make a very ugly dimension, so you might want to group them using a Class() function. Like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Class(Sum(Aggr(If(Sum(Stock_Qty) &amp;gt; 0 And Sum(Stock_Qty) &amp;gt; ($(VMonths) * Sum(AvrgSales)), Sum(Stock_Qty) - ($(VMonths) * Sum(AvrgSales))), itemName, [exp date])) ,&lt;STRONG&gt;100&lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(adjust the class size (100 in the example) acccording to your needs and change the field name(s) to the correct ones for your document)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 13:51:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Formula-in-Calculated-Dimension/m-p/774843#M1044613</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2014-12-04T13:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: Formula in Calculated Dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Formula-in-Calculated-Dimension/m-p/774844#M1044614</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;yes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 13:51:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Formula-in-Calculated-Dimension/m-p/774844#M1044614</guid>
      <dc:creator>alexandros17</dc:creator>
      <dc:date>2014-12-04T13:51:45Z</dc:date>
    </item>
    <item>
      <title>Re: Formula in Calculated Dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Formula-in-Calculated-Dimension/m-p/774845#M1044615</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13.63636302948px;"&gt;Yes each ItemName has one &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.7272720336914px;"&gt;AvrgSales loded in Qlikview this value is unique by ItemName and dose not change. Actually it is an estimation of the sales.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.63636302948px;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.7272720336914px;"&gt;VMonths is defined using a slider in QlikView.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.63636302948px;"&gt;&lt;SPAN style="color: #3d3d3d; font-size: 12.7272720336914px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;You mean " by &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.7272720336914px;"&gt; stray?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.63636302948px;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.7272720336914px;"&gt;In my formula I am using sum many times with each sum I have to use aggr()?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.7272720336914px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2014 13:54:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Formula-in-Calculated-Dimension/m-p/774845#M1044615</guid>
      <dc:creator />
      <dc:date>2014-12-04T13:54:27Z</dc:date>
    </item>
  </channel>
</rss>

