Group sum on calculated field
I want to be able to create a group sum on a calculated field within the
same datapipeline.
For example, my current pipeline looks like the following:
Datapipeline PL1
Tables A, B, C
Fields AId
Where A.AId = B.Id and A.AId = C.Id
Calc (Function = Expression) Expression: B.Amt - C.Amt
Order By B.Amt-C.Amt
I want to be able to group by the AId and do a sum on the calc field
B.Amt - C.Amt. That is Sum(B.Amt - C.Amt) for multiple records with the
same AId value. I would like to do this in the pipeline itself and then
finally sort (Order by) the group sum instead of the calc field (B.Amt -
C.Amt).
Is this possible?
Thanks in advance
Prathy Kukkalli
same datapipeline.
For example, my current pipeline looks like the following:
Datapipeline PL1
Tables A, B, C
Fields AId
Where A.AId = B.Id and A.AId = C.Id
Calc (Function = Expression) Expression: B.Amt - C.Amt
Order By B.Amt-C.Amt
I want to be able to group by the AId and do a sum on the calc field
B.Amt - C.Amt. That is Sum(B.Amt - C.Amt) for multiple records with the
same AId value. I would like to do this in the pipeline itself and then
finally sort (Order by) the group sum instead of the calc field (B.Amt -
C.Amt).
Is this possible?
Thanks in advance
Prathy Kukkalli
This discussion has been closed.
Comments
You can certainly create a TQuery which contains:
SELECT A.Company,
SUM(B.Amt - C.Amt) AmountOwed
FROM A INNER JOIN B ON (A.Id = B.Id)
INNER JOIN C ON (B.Id = C.Id)
GROUP BY A.Company
ORDER BY 2
Tom Ollar
Digital Metaphors Corporation
http://www.digital-metaphors.com
info@digital-metaphors.com