<?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: Pivot-Calculation baesd on calculated previous value in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Pivot-Calculation-baesd-on-calculated-previous-value/m-p/1557458#M40593</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;many thanks for the answer.&lt;/P&gt;&lt;P&gt;Exactly this formula I have already developed, but that is not the desired result. The correct result for value(4) is 5.22.&lt;BR /&gt;Maybe the logic at the value 5 becomes a little clearer. Here I would expect now as follows.&lt;BR /&gt;Original value (5) * Month (5) minus the sum of the previous calculated values.&lt;/P&gt;&lt;P&gt;So:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Value5 = 6.31 * 5- (6.54 + 7.66 + 6.28 + 5.66)&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;And this is where your value deviates even more from the desired result.&lt;BR /&gt;The problem is that the formula in principle refers to itself, so a circular reference. In Excel you can solve this great, because it is cell based.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here are the correctly calculated results.&amp;nbsp;I do not know how to attach an Excel file here, otherwise I would have done that.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-03-15_23h05_14.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/8182i810662C5F70B5378/image-size/large?v=v2&amp;amp;px=999" role="button" title="2019-03-15_23h05_14.png" alt="2019-03-15_23h05_14.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-03-15_23h12_17.png" style="width: 406px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/8184i74FCD063290F8958/image-dimensions/406x149?v=v2" width="406" height="149" role="button" title="2019-03-15_23h12_17.png" alt="2019-03-15_23h12_17.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-03-15_23h12_29.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/8186i6641C3102070A720/image-size/large?v=v2&amp;amp;px=999" role="button" title="2019-03-15_23h12_29.png" alt="2019-03-15_23h12_29.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have already tried using an if-formula every month. But at month 10 from 40,000 characters Qlik Sense did not join in then &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;That was really just an experiment for a stopgap.&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-03-15_23h10_14.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/8183iF67A232F0EFE96E1/image-size/large?v=v2&amp;amp;px=999" role="button" title="2019-03-15_23h10_14.png" alt="2019-03-15_23h10_14.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;mfg&lt;/P&gt;&lt;P&gt;Marcel&lt;/P&gt;</description>
    <pubDate>Fri, 15 Mar 2019 22:15:02 GMT</pubDate>
    <dc:creator>marcel_h</dc:creator>
    <dc:date>2019-03-15T22:15:02Z</dc:date>
    <item>
      <title>Pivot-Calculation baesd on calculated previous value</title>
      <link>https://community.qlik.com/t5/App-Development/Pivot-Calculation-baesd-on-calculated-previous-value/m-p/1556952#M40545</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I challenge to compute a value in a pivot table based on each month and its pre-value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have tried a few with rangesum () and before (), but I just can not get the result you want.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Condition:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have a pivot table. In the columns I have the months 1-12. Then I have a selective metric for each month.&amp;nbsp;The recalculated measure is based on the corresponding month and the sum of the calculated previous values.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1. Example value for month 1 is the original value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2. Value for month 2 is "original value * 2 - sum(calculated pre-values)."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3. Value for month 3 is "original value * 3 - sum(calculated pre-values)".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;4. ......&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-03-15_08h30_28.png" style="width: 877px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/8096i1B7FE2861B721D20/image-size/large?v=v2&amp;amp;px=999" role="button" title="2019-03-15_08h30_28.png" alt="2019-03-15_08h30_28.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In the example above, I've built my own formula for each month in each row. But i want to show the values in one row and without this temporary rows.&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;v1 = &lt;BR /&gt;if(Monat=1 ,column(1) )&lt;/PRE&gt;&lt;PRE&gt;v2 = &lt;BR /&gt;if(Monat=2
	,column(1) * Monat - before(column(1))
    )&lt;/PRE&gt;&lt;PRE&gt;v3 = 
if(Monat=3
	,column(1) * Monat - rangesum(before(column(2),2), before(column(3),1))
    )&lt;/PRE&gt;&lt;PRE&gt;v4 =
if(Monat=4
	,column(1) * Monat - rangesum(before(column(2),3), before(column(3),2), before(column(4),1))
    )&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;I hope that it was understandable and someone can help me.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks in advance.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;mfg&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Marcel&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 06:19:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Pivot-Calculation-baesd-on-calculated-previous-value/m-p/1556952#M40545</guid>
      <dc:creator>marcel_h</dc:creator>
      <dc:date>2024-11-16T06:19:43Z</dc:date>
    </item>
    <item>
      <title>Re: Pivot-Calculation baesd on calculated previous value</title>
      <link>https://community.qlik.com/t5/App-Development/Pivot-Calculation-baesd-on-calculated-previous-value/m-p/1557424#M40590</link>
      <description>&lt;P&gt;In your example the numbers from the "stairs" pivot are not correct, they don't show the result which you added in red text .... the 4th column should be 5.05% ...&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-03-15 21_45_55-Window.png" style="width: 305px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/8173i8D09387846B7E601/image-size/large?v=v2&amp;amp;px=999" role="button" title="2019-03-15 21_45_55-Window.png" alt="2019-03-15 21_45_55-Window.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;---&lt;/P&gt;
&lt;P&gt;However, the formula you need is this ... replace Sum(Value) with whatever your formula is&lt;/P&gt;
&lt;P&gt;Sum(Value)*Monat - RangeSum(Before(Sum(Value), 1, ColumnNo()))&lt;/P&gt;
&lt;P&gt;The part you missed is that Before can not only return one value, but with a 2nd and 3rd parameter of the function it can (like Excel) return a whole array, for which you need a RangeSum() around it to build the total. The 2nd gives the offset where to start (1 means begin with the next column to the left) and the 3rd argument defines the number of cells to go to the left. So if you are at column 4, you needed this: Before(Sum(Value), 1, 4) ... To make the 3rd parameter dynamic, I put in the function ColumnNo()&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-03-15 21_50_13-Window.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/8174i4060EBA2680F0D27/image-size/large?v=v2&amp;amp;px=999" role="button" title="2019-03-15 21_50_13-Window.png" alt="2019-03-15 21_50_13-Window.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 20:50:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Pivot-Calculation-baesd-on-calculated-previous-value/m-p/1557424#M40590</guid>
      <dc:creator>ChristofSchwarz</dc:creator>
      <dc:date>2019-03-15T20:50:40Z</dc:date>
    </item>
    <item>
      <title>Re: Pivot-Calculation baesd on calculated previous value</title>
      <link>https://community.qlik.com/t5/App-Development/Pivot-Calculation-baesd-on-calculated-previous-value/m-p/1557458#M40593</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;many thanks for the answer.&lt;/P&gt;&lt;P&gt;Exactly this formula I have already developed, but that is not the desired result. The correct result for value(4) is 5.22.&lt;BR /&gt;Maybe the logic at the value 5 becomes a little clearer. Here I would expect now as follows.&lt;BR /&gt;Original value (5) * Month (5) minus the sum of the previous calculated values.&lt;/P&gt;&lt;P&gt;So:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Value5 = 6.31 * 5- (6.54 + 7.66 + 6.28 + 5.66)&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;And this is where your value deviates even more from the desired result.&lt;BR /&gt;The problem is that the formula in principle refers to itself, so a circular reference. In Excel you can solve this great, because it is cell based.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here are the correctly calculated results.&amp;nbsp;I do not know how to attach an Excel file here, otherwise I would have done that.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-03-15_23h05_14.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/8182i810662C5F70B5378/image-size/large?v=v2&amp;amp;px=999" role="button" title="2019-03-15_23h05_14.png" alt="2019-03-15_23h05_14.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-03-15_23h12_17.png" style="width: 406px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/8184i74FCD063290F8958/image-dimensions/406x149?v=v2" width="406" height="149" role="button" title="2019-03-15_23h12_17.png" alt="2019-03-15_23h12_17.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-03-15_23h12_29.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/8186i6641C3102070A720/image-size/large?v=v2&amp;amp;px=999" role="button" title="2019-03-15_23h12_29.png" alt="2019-03-15_23h12_29.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have already tried using an if-formula every month. But at month 10 from 40,000 characters Qlik Sense did not join in then &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;That was really just an experiment for a stopgap.&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-03-15_23h10_14.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/8183iF67A232F0EFE96E1/image-size/large?v=v2&amp;amp;px=999" role="button" title="2019-03-15_23h10_14.png" alt="2019-03-15_23h10_14.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;mfg&lt;/P&gt;&lt;P&gt;Marcel&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 22:15:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Pivot-Calculation-baesd-on-calculated-previous-value/m-p/1557458#M40593</guid>
      <dc:creator>marcel_h</dc:creator>
      <dc:date>2019-03-15T22:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: Pivot-Calculation baesd on calculated previous value</title>
      <link>https://community.qlik.com/t5/App-Development/Pivot-Calculation-baesd-on-calculated-previous-value/m-p/1557491#M40602</link>
      <description>&lt;P&gt;Same can be done in Qlik ....&lt;/P&gt;
&lt;P&gt;Sum(Value)*Monat - RangeSum(Before(&lt;U&gt;&lt;STRONG&gt;Column(1)&lt;/STRONG&gt;&lt;/U&gt;, 1, ColumnNo()))&lt;/P&gt;
&lt;P&gt;I don't have your percentage values at a 2 digit precision, but from a first look, they are now identical.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-03-16 10_35_49-Window.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/8192iF786E91A40E656A9/image-size/large?v=v2&amp;amp;px=999" role="button" title="2019-03-16 10_35_49-Window.png" alt="2019-03-16 10_35_49-Window.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;PS contact me at csw@qlik.com if this still doesn't solve it, so we can exchange files or have a screen sharing session&lt;/P&gt;</description>
      <pubDate>Sat, 16 Mar 2019 09:36:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Pivot-Calculation-baesd-on-calculated-previous-value/m-p/1557491#M40602</guid>
      <dc:creator>ChristofSchwarz</dc:creator>
      <dc:date>2019-03-16T09:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: Pivot-Calculation baesd on calculated previous value</title>
      <link>https://community.qlik.com/t5/App-Development/Pivot-Calculation-baesd-on-calculated-previous-value/m-p/1557495#M40604</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;thank you very much.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;It worked &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;mfg&lt;/P&gt;&lt;P&gt;Marcel&lt;/P&gt;</description>
      <pubDate>Sat, 16 Mar 2019 10:05:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Pivot-Calculation-baesd-on-calculated-previous-value/m-p/1557495#M40604</guid>
      <dc:creator>marcel_h</dc:creator>
      <dc:date>2019-03-16T10:05:12Z</dc:date>
    </item>
  </channel>
</rss>

