Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

row minus row?

I have two tables with same structure

I want 1st row of 1st table to be subtract from  1st row of second table

then 2nd row of 1st table to be subtracted from 2nd row of second table

and so on...

thanks in advance

1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

Check the below steps

Qualify *;

UnQualify Code;

Table1:

Load

     *

Excel file source 1;

Table2:

Load

     *

Excel file source 2;

Create a straight table in chart and add Text fields in dimension and Expressions as

Table1.FieldName - Table2.FieldName

Hope it helps

View solution in original post

15 Replies
chiru_thota
Specialist
Specialist

Can you upload a sample ?

CELAMBARASAN
Partner - Champion
Partner - Champion

Table you meant in presentation or in script?

Its better, if you could upload sample file.

Anonymous
Not applicable
Author

PFA, if it helps you

MK_QSL
MVP
MVP

hope this helps...

Not applicable
Author

These are two sample files that i have attached.  I want to subtract data of table1 from table22.

Not applicable
Author

This is my script.

tab1:

LOAD Particulars as Code1,

     F2 as [Name of Entity],

     [Gross Service Revenue billed to third party customers],

     [Third Party Network costs],

     [Third party Other costs],

     [Total Third Party costs],

     [Salary cost - Selling and Marketing],

     [Salary cost  - Network Maintenance],

     [Salary cost - General and Admin],

     [General and Admin expenses - Overheads],

     [Total Internal costs],

     [Total costs],

     [Operating Margin before Depreciation],

     Depreciation,

     [Operating Margin after Depreciation],

     [Legacy adjustment for IRU amortisation],

     [Special Adjustment],

     [Operating Profit for RPSM],

     [Computation of Arms Length Profit under the Residual Profit Split Method],

     [Average Operating Assets employed during the quarter],

     [Return % on Operating Assets employed],

     [Return on Average Operating Assets employed during the quarter],

     Depreciation1,

     [Adjustment for contract value],

     [Depreciation eligible for reimbursement],

     [Routine return on operating assets],

     [Return % for Selling and Marketing],

     [Return % for Network Maintenance],

     [Return % for General and Admin],

     [Return on Selling and Marketing Routine Function],

     [Return on Network Maintenance Routine Function],

     [Return on General Admin Routine Function],

     [Total Return on Routine Functions],

     [Total Routine Return on Operating Assets and Routine Functions],

     [Residual Operating Profit / (Loss) for the group for the quarter],

     [Value Added Driver Weighted Average ratio],

     [Distribution of Residual Operating Profit / (Loss) to Tier 1 entities],

     [Total Eligible Return],

     [Target Revenue],

     [Transfer Pricing Adjustment Receive / (Pay)],

     [TPA Remuneration %],

     Remuneration,

     [Final Transfer Pricing Adjustment Income / (Expense)],

     [Average Exchange rate],

     [Closing Exchange rate]

FROM

(biff, embedded labels, header is 8 lines, table is [RPSM 04 to 04 2012$], filters(

Remove(Col, Pos(Top, 3)),

Remove(Col, Pos(Top, 1)),

Remove(Col, Pos(Top, 2)),

Remove(Col, Pos(Top, 1)),

Remove(Col, Pos(Top, 3)),

Remove(Col, Pos(Top, 2)),

Remove(Col, Pos(Top, 2)),

Transpose()

));

tab2:

Concatenate

LOAD Particulars as Code2,

     F2 as [Name of Entity] ,

     [Gross Service Revenue billed to third party customers],

     [Third Party Network costs],

     [Third party Other costs],

     [Total Third Party costs],

     [Salary cost - Selling and Marketing],

     [Salary cost  - Network Maintenance],

     [Salary cost - General and Admin],

     [General and Admin expenses - Overheads],

     [Total Internal costs],

     [Total costs],

     [Operating Margin before Depreciation],

     Depreciation,

     [Operating Margin after Depreciation],

     [Legacy adjustment for IRU amortisation],

     [Special Adjustment],

     [Operating Profit for RPSM],

     [Computation of Arms Length Profit under the Residual Profit Split Method],

     [Average Operating Assets employed during the quarter],

     [Return % on Operating Assets employed],

     [Return on Average Operating Assets employed during the quarter],

     Depreciation1,

     [Adjustment for contract value],

     [Depreciation eligible for reimbursement],

     [Routine return on operating assets],

     [Return % for Selling and Marketing],

     [Return % for Network Maintenance],

     [Return % for General and Admin],

     [Return on Selling and Marketing Routine Function],

     [Return on Network Maintenance Routine Function],

     [Return on General Admin Routine Function],

     [Total Return on Routine Functions],

     [Total Routine Return on Operating Assets and Routine Functions],

     [Residual Operating Profit / (Loss) for the group for the quarter],

     [Value Added Driver Weighted Average ratio],

     [Distribution of Residual Operating Profit / (Loss) to Tier 1 entities],

     [Total Eligible Return],

     [Target Revenue],

     [Transfer Pricing Adjustment Receive / (Pay)],

     [TPA Remuneration %],

     Remuneration,

     [Final Transfer Pricing Adjustment Income / (Expense)],

     [Average Exchange rate],

     [Closing Exchange rate]

FROM

(biff, embedded labels, header is 8 lines, table is [RPSM 04 to 05 2012$], filters(

Remove(Col, Pos(Top, 3)),

Remove(Col, Pos(Top, 2)),

Remove(Col, Pos(Top, 1)),

Remove(Col, Pos(Top, 3)),

Remove(Col, Pos(Top, 1)),

Remove(Col, Pos(Top, 3)),

Remove(Col, Pos(Top, 2)),

Remove(Col, Pos(Top, 3)),

Transpose()

));

NoConcatenate

tab3:

LOAD

tab2.code2 - tab1.code1  as diff

resident tab1;

--------------------------------------------------------------------------------

but it is giving me error:

Field not found - <tab2.code2>

NoConcatenate

tab3:

LOAD

tab2.code2 - tab1.code1  as diff

resident tab1

CELAMBARASAN
Partner - Champion
Partner - Champion

Check the below steps

Qualify *;

UnQualify Code;

Table1:

Load

     *

Excel file source 1;

Table2:

Load

     *

Excel file source 2;

Create a straight table in chart and add Text fields in dimension and Expressions as

Table1.FieldName - Table2.FieldName

Hope it helps

CELAMBARASAN
Partner - Champion
Partner - Champion

After concatenate it forms two table in to one. Table 2 no longer exists there to refer.

Not applicable
Author

But I want to do calculation in script and want to store result in a qvd.....