Sort by sum of multiple tables


I'm having trouble with sorting by sum. I have read through a few posts and have nailed down sorting from a separate table but I want to use the sum of multiple tables.

I want a report that produces a list of the top 10 highest costed jobs. 

We store the jobs in question in the Service Call table. Invoiced costs are stored in the Contract Ledger Entry table and Committed Costs in the Contract Committed Costs table. Total cost for a job is therefore made of the sum of the two 

This would give me the top 10 jobs by invoiced costs 

=NL("Rows","Service Call",, "Limit=","10","-=NL(""Sum"",""Contract Ledger Entry"",""Line Amount (LCY)"", ""Contract No."",NF(,""Call No.""))","*")

or this the top 10 jobs by committed cost

=NL("Rows","Service Call",, "Limit=","10","-=NL(""Sum"",""Contract Committed Costs"",""Total Cost (LCY)"", ""Contract No."",NF(,""Call No.""))","*")

but can I sort (the "sum of invoiced costs" plus the "sum of committed costs") and then limit the result. I want something like 

=NL("Rows","Service Call",, "Limit=","10","-(=NL(""Sum"",""Contract Ledger Entry"",""Line Amount (LCY)"", ""Contract No."",NF(,""Call No.""))+NL(""Sum"",""Contract Committed Costs"",""Total Cost (LCY)"", ""Contract No."",NF(,""Call No."")))","*")

There are extra filters but i have excluded these to make showing the principle idea easier.

Any help would be greatly appreciated.




Please sign in to leave a comment.