<?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: Row wise calculations in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Row-wise-calculations/m-p/515995#M693393</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;T1:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type, Value&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Room Expenditure, 700&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Telephone Expenditure, 500&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Room Profit, 400&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Telephone Profit, 100&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;load 'Room Cost' as Type,&lt;/P&gt;&lt;P&gt;sum(if(Type='Room Expenditure', Value, if(Type='Room Profit',-Value,0 ))) as Value&lt;/P&gt;&lt;P&gt;resident T1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;load 'Telephone Cost' as Type,&lt;/P&gt;&lt;P&gt;sum(if(Type='Telephone Expenditure', Value, if(Type='Telephone Profit',-Value,0 ))) as Value&lt;/P&gt;&lt;P&gt;resident T1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See attached qvw&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Aug 2013 07:21:48 GMT</pubDate>
    <dc:creator>Gysbert_Wassenaar</dc:creator>
    <dc:date>2013-08-22T07:21:48Z</dc:date>
    <item>
      <title>Row wise calculations</title>
      <link>https://community.qlik.com/t5/QlikView/Row-wise-calculations/m-p/515993#M693391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a below data table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Type&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Value&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Room Expenditure&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;700&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Telephone Expenditure&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;500&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Room Profit&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;400&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Telephone Profit&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want expected table as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Type&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Value&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Room Expenditure&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;700&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Telephone Expenditure&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;500&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;STRONG&gt;Room Cost&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;STRONG&gt;300&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;STRONG&gt;Telephone Cost&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;STRONG&gt;400&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Room Profit&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;400&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Telephone Profit&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Room Cost = Room Expenditure- Room Profit &lt;/P&gt;&lt;P&gt;same for telephone and other Types present in the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I calculate and generate these new rows in script?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help greatly appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Aug 2013 07:04:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Row-wise-calculations/m-p/515993#M693391</guid>
      <dc:creator>AbhijitBansode</dc:creator>
      <dc:date>2013-08-22T07:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: Row wise calculations</title>
      <link>https://community.qlik.com/t5/QlikView/Row-wise-calculations/m-p/515994#M693392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Abhijit,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have any field to group the different types? Or just have to compare each name?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you sure that this output wouldn´t be better for your document? (All the fact tables in the same row)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Type&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Cost&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Expenditure&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Profit&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Room&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;200&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;350&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;150&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Telephone&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;300&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;440&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;140&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Aug 2013 07:19:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Row-wise-calculations/m-p/515994#M693392</guid>
      <dc:creator />
      <dc:date>2013-08-22T07:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: Row wise calculations</title>
      <link>https://community.qlik.com/t5/QlikView/Row-wise-calculations/m-p/515995#M693393</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;T1:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type, Value&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Room Expenditure, 700&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Telephone Expenditure, 500&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Room Profit, 400&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Telephone Profit, 100&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;load 'Room Cost' as Type,&lt;/P&gt;&lt;P&gt;sum(if(Type='Room Expenditure', Value, if(Type='Room Profit',-Value,0 ))) as Value&lt;/P&gt;&lt;P&gt;resident T1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;load 'Telephone Cost' as Type,&lt;/P&gt;&lt;P&gt;sum(if(Type='Telephone Expenditure', Value, if(Type='Telephone Profit',-Value,0 ))) as Value&lt;/P&gt;&lt;P&gt;resident T1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See attached qvw&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Aug 2013 07:21:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Row-wise-calculations/m-p/515995#M693393</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-08-22T07:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: Row wise calculations</title>
      <link>https://community.qlik.com/t5/QlikView/Row-wise-calculations/m-p/515996#M693394</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works correctly, but i need to hardcore for all Types. &lt;/P&gt;&lt;P&gt;There are other Types present in the table other than Room and Telephone.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@ IOSU GARCIA&lt;/P&gt;&lt;P&gt;Right now I don't have any field to group different types.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Aug 2013 07:41:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Row-wise-calculations/m-p/515996#M693394</guid>
      <dc:creator>AbhijitBansode</dc:creator>
      <dc:date>2013-08-22T07:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: Row wise calculations</title>
      <link>https://community.qlik.com/t5/QlikView/Row-wise-calculations/m-p/515997#M693395</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you don't have any field to group all the different types, you need one. Try creating a new field with this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SubField(Type, ' ', 1) as NewType,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // For differenciating Telephone, room,...&lt;/P&gt;&lt;P&gt;SubField(Type, ' ', 2) as DataType&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // For differenciating Expenses, cost...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once you have this new fields, it will be easy to achieve what you want, just following what Wassennar posted.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Aug 2013 07:49:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Row-wise-calculations/m-p/515997#M693395</guid>
      <dc:creator />
      <dc:date>2013-08-22T07:49:38Z</dc:date>
    </item>
  </channel>
</rss>

