<?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: How to insert row and calculate value based on above two rows in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-insert-row-and-calculate-value-based-on-above-two-rows/m-p/1783703#M1209789</link>
    <description>&lt;P&gt;You don't need to calculate all values within the script but you need to add all artificial/extra dimension-values for all totals respectively intermediate calculations which aren't feasible with the partial sums within the object.&lt;/P&gt;&lt;P&gt;This means in your case something like:&lt;/P&gt;&lt;P&gt;concatenate(YourTable) load pick('EBITDA1', 'EBITDA2', recno()) as Group autogenerate 2;&lt;/P&gt;&lt;P&gt;adding just the dimension-values to your field. If they are there you could query them within your chart expressions like:&lt;/P&gt;&lt;P&gt;if(Group = 'EBITDA1', expr1,&amp;nbsp;Group = 'EBITDA2', expr2, expr3))&lt;/P&gt;&lt;P&gt;If there are more as two such special calculations it becomes useful if there are flag-values which indicates if certain values are positive or negative to avoid further if-loops querying and branching for this information.&lt;/P&gt;&lt;P&gt;A step further in this logic would be to integrate the extra dimension-values within an&amp;nbsp;&lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/The-As-Of-Table/ba-p/1466130" target="_blank"&gt;The As-Of Table - Qlik Community - 1466130&lt;/A&gt;&amp;nbsp;which would avoid any branching and a simple sum(value) would be enough - unless by any rate-calculations which I wouldn't mix with the sums else applying it within an extra column.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
    <pubDate>Thu, 18 Feb 2021 07:51:06 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2021-02-18T07:51:06Z</dc:date>
    <item>
      <title>How to insert row and calculate value based on above two rows</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-insert-row-and-calculate-value-based-on-above-two-rows/m-p/1783435#M1209755</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I want to calculate insert two rows and calculate EBITDA Rs/T &amp;amp; EBITDA Rs Cr. based on NSR &amp;amp; Cos. My data is as follows:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Unit&lt;/TD&gt;&lt;TD&gt;Group&lt;/TD&gt;&lt;TD&gt;CHD&lt;/TD&gt;&lt;TD&gt;GGBS&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;DLV&lt;/TD&gt;&lt;TD&gt;Production_Sales qty.&lt;/TD&gt;&lt;TD&gt;10000&lt;/TD&gt;&lt;TD&gt;5000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;DLV&lt;/TD&gt;&lt;TD&gt;NSR Part&lt;/TD&gt;&lt;TD&gt;5000&lt;/TD&gt;&lt;TD&gt;2000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;DLV&lt;/TD&gt;&lt;TD&gt;Cos&lt;/TD&gt;&lt;TD&gt;4000&lt;/TD&gt;&lt;TD&gt;900&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;NDL&lt;/TD&gt;&lt;TD&gt;Production_Sales qty.&lt;/TD&gt;&lt;TD&gt;11000&lt;/TD&gt;&lt;TD&gt;6000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;NDL&lt;/TD&gt;&lt;TD&gt;NSR Part&lt;/TD&gt;&lt;TD&gt;5100&lt;/TD&gt;&lt;TD&gt;2100&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;NDL&lt;/TD&gt;&lt;TD&gt;Cos&lt;/TD&gt;&lt;TD&gt;4200&lt;/TD&gt;&lt;TD&gt;950&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have made App like this:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Unit&lt;/TD&gt;&lt;TD&gt;Group&lt;/TD&gt;&lt;TD&gt;CHD&lt;/TD&gt;&lt;TD&gt;GGBS&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;DLV&lt;/TD&gt;&lt;TD&gt;Production_Sales qty.&lt;/TD&gt;&lt;TD&gt;10000&lt;/TD&gt;&lt;TD&gt;5000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;NSR Part&lt;/TD&gt;&lt;TD&gt;5000&lt;/TD&gt;&lt;TD&gt;2000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Cos&lt;/TD&gt;&lt;TD&gt;4000&lt;/TD&gt;&lt;TD&gt;900&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;NDL&lt;/TD&gt;&lt;TD&gt;Production_Sales qty.&lt;/TD&gt;&lt;TD&gt;11000&lt;/TD&gt;&lt;TD&gt;6000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;NSR Part&lt;/TD&gt;&lt;TD&gt;5100&lt;/TD&gt;&lt;TD&gt;2100&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Cos&lt;/TD&gt;&lt;TD&gt;4200&lt;/TD&gt;&lt;TD&gt;950&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What i want is the yellow lines as shown below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Learner_0-1613567792448.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/49263iAA32229C86257746/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Learner_0-1613567792448.png" alt="Learner_0-1613567792448.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;EBITDA Rs/T is Row no. 2 less row no. 3 in Unit DLV same for NDL unit.&lt;/P&gt;&lt;P&gt;EBITDA Rs Cr. is Row no. 4 * Row no. 1 in Unit DLV same for NDL unit.&lt;/P&gt;&lt;P&gt;Please help me out in the above report......&lt;/P&gt;&lt;P&gt;with regards,&lt;/P&gt;&lt;P&gt;Ashish&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 13:19:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-insert-row-and-calculate-value-based-on-above-two-rows/m-p/1783435#M1209755</guid>
      <dc:creator>Learner</dc:creator>
      <dc:date>2021-02-17T13:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert row and calculate value based on above two rows</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-insert-row-and-calculate-value-based-on-above-two-rows/m-p/1783451#M1209759</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/122480"&gt;@Learner&lt;/a&gt;&amp;nbsp;, please see if this is an acceptable solution for you :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="QFabian_0-1613571414740.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/49270iF03C28865C0CE166/image-size/medium?v=v2&amp;amp;px=400" role="button" title="QFabian_0-1613571414740.png" alt="QFabian_0-1613571414740.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The final number for 'EBITDA Rs Cr.' is the unique difference, please check&lt;/P&gt;&lt;P&gt;DataX:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;Unit, Group, CHD, GGBS&lt;BR /&gt;DLV, Production_Sales qty., 10000, 5000&lt;BR /&gt;DLV, NSR Part, 5000, 2000&lt;BR /&gt;DLV, Cos, 4000, 900&lt;BR /&gt;NDL, Production_Sales qty., 11000, 6000&lt;BR /&gt;NDL, NSR Part, 5100, 2100&lt;BR /&gt;NDL, Cos, 4200, 950&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;Data:&lt;BR /&gt;Load&lt;BR /&gt;AutoNumber(Group, Unit) as Id,&lt;BR /&gt;Unit,&lt;BR /&gt;Group,&lt;BR /&gt;CHD,&lt;BR /&gt;GGBS&lt;BR /&gt;Resident DataX;&lt;BR /&gt;drop table DataX;&lt;BR /&gt;concatenate&lt;BR /&gt;Load distinct&lt;BR /&gt;Unit,&lt;BR /&gt;4 as Id,&lt;BR /&gt;'EBITDA RS / T' as Group&lt;BR /&gt;Resident Data;&lt;BR /&gt;concatenate&lt;BR /&gt;Load distinct&lt;BR /&gt;Unit,&lt;BR /&gt;5 as Id,&lt;BR /&gt;'EBITDA Rs Cr.' as Group&lt;BR /&gt;Resident Data;&lt;/P&gt;&lt;P&gt;Data2:&lt;BR /&gt;Load&lt;BR /&gt;1 as Id2,&lt;BR /&gt;Unit,&lt;BR /&gt;Group,&lt;BR /&gt;Id,&lt;BR /&gt;if(Id = 4, previous(previous(CHD)) - previous(CHD),&lt;BR /&gt;if(Id = 5, peek(CHD2) / previous(previous(previous(previous(CHD)))), CHD)) as CHD2,&lt;/P&gt;&lt;P&gt;if(Id = 4, previous(previous(GGBS)) - previous(GGBS),&lt;BR /&gt;if(Id = 5, peek(GGBS2) / previous(previous(previous(previous(GGBS)))), GGBS)) as GGBS2&lt;/P&gt;&lt;P&gt;Resident Data&lt;BR /&gt;order by&lt;BR /&gt;Unit,&lt;BR /&gt;Id;&lt;BR /&gt;drop table Data;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 14:16:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-insert-row-and-calculate-value-based-on-above-two-rows/m-p/1783451#M1209759</guid>
      <dc:creator>QFabian</dc:creator>
      <dc:date>2021-02-17T14:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert row and calculate value based on above two rows</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-insert-row-and-calculate-value-based-on-above-two-rows/m-p/1783683#M1209785</link>
      <description>&lt;P&gt;Many Thanks...... it does work......&lt;/P&gt;&lt;P&gt;But&amp;nbsp; is there any way to do this in front end i.e. in Expression and Dimension. we can add extra row and write formula as row no. 3 minus row no. 2. I am asking this because if there are lots of Columns &amp;amp; row than it will be difficult for write formula for each column(as in the example there are only 2 columns CHD &amp;amp; GGBS).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanking you,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ashish&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 06:02:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-insert-row-and-calculate-value-based-on-above-two-rows/m-p/1783683#M1209785</guid>
      <dc:creator>Learner</dc:creator>
      <dc:date>2021-02-18T06:02:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert row and calculate value based on above two rows</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-insert-row-and-calculate-value-based-on-above-two-rows/m-p/1783703#M1209789</link>
      <description>&lt;P&gt;You don't need to calculate all values within the script but you need to add all artificial/extra dimension-values for all totals respectively intermediate calculations which aren't feasible with the partial sums within the object.&lt;/P&gt;&lt;P&gt;This means in your case something like:&lt;/P&gt;&lt;P&gt;concatenate(YourTable) load pick('EBITDA1', 'EBITDA2', recno()) as Group autogenerate 2;&lt;/P&gt;&lt;P&gt;adding just the dimension-values to your field. If they are there you could query them within your chart expressions like:&lt;/P&gt;&lt;P&gt;if(Group = 'EBITDA1', expr1,&amp;nbsp;Group = 'EBITDA2', expr2, expr3))&lt;/P&gt;&lt;P&gt;If there are more as two such special calculations it becomes useful if there are flag-values which indicates if certain values are positive or negative to avoid further if-loops querying and branching for this information.&lt;/P&gt;&lt;P&gt;A step further in this logic would be to integrate the extra dimension-values within an&amp;nbsp;&lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/The-As-Of-Table/ba-p/1466130" target="_blank"&gt;The As-Of Table - Qlik Community - 1466130&lt;/A&gt;&amp;nbsp;which would avoid any branching and a simple sum(value) would be enough - unless by any rate-calculations which I wouldn't mix with the sums else applying it within an extra column.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 07:51:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-insert-row-and-calculate-value-based-on-above-two-rows/m-p/1783703#M1209789</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2021-02-18T07:51:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert row and calculate value based on above two rows</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-insert-row-and-calculate-value-based-on-above-two-rows/m-p/1783900#M1209810</link>
      <description>&lt;P&gt;Thank you for your response.......&lt;/P&gt;&lt;P&gt;I tried typing the concatenate function in script but ,as i am new to scripting,&amp;nbsp; it did not worked may be i have written incorrectly. Here is what i wrote:&lt;/P&gt;&lt;P&gt;DataX:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;Unit, Group, CHD, GGBS&lt;BR /&gt;DLV, Production_Sales qty., 10000, 5000&lt;BR /&gt;DLV, NSR Part, 5000, 2000&lt;BR /&gt;DLV, Cos, 4000, 900&lt;BR /&gt;NDL, Production_Sales qty., 11000, 6000&lt;BR /&gt;NDL, NSR Part, 5100, 2100&lt;BR /&gt;NDL, Cos, 4200, 950&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;concatenate(DataX)&lt;BR /&gt;load&lt;BR /&gt;pick('EBITDA1', 'EBITDA2', recno()) as Group autogenerate 2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but no extra row was created.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Learner_0-1613662278967.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/49387i4E04CEAB93A94C2D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Learner_0-1613662278967.png" alt="Learner_0-1613662278967.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Screen shot of Chart &amp;amp; list box both.(EBITDA1 &amp;amp; EBITDA2 does not appears)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know where i am making mistake.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanking you,&lt;/P&gt;&lt;P&gt;Ashish&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 15:32:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-insert-row-and-calculate-value-based-on-above-two-rows/m-p/1783900#M1209810</guid>
      <dc:creator>Learner</dc:creator>
      <dc:date>2021-02-18T15:32:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert row and calculate value based on above two rows</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-insert-row-and-calculate-value-based-on-above-two-rows/m-p/1783905#M1209811</link>
      <description>&lt;P&gt;Sorry, I mistake the parameter-order of pick() - therefore change it to:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;concatenate(DataX)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;load&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pick(recno(), 'EBITDA1', 'EBITDA2') as Group autogenerate 2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 15:38:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-insert-row-and-calculate-value-based-on-above-two-rows/m-p/1783905#M1209811</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2021-02-18T15:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert row and calculate value based on above two rows</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-insert-row-and-calculate-value-based-on-above-two-rows/m-p/1784046#M1209827</link>
      <description>&lt;P&gt;Thank you it worked...............&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 05:38:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-insert-row-and-calculate-value-based-on-above-two-rows/m-p/1784046#M1209827</guid>
      <dc:creator>Learner</dc:creator>
      <dc:date>2021-02-19T05:38:33Z</dc:date>
    </item>
  </channel>
</rss>

