Need a solution to prorate values for duplicated records

Please consider the following dataset: This is a result of SQL query that uses a join on
LEFT JOIN t1 on t2.parentid =

t1.parentid | t2.childid | t1. amount
A | B | 500
A | C | 500
D | E | 100

I need to prorate the amount value for records having the same parentid so that sum(amount) = 600 not 1100.
I tried using a simple calculation but encounter the error “not allowed aggregate and nonaggregate data together”.

Hi @alQemay,

You can use LAC-A functions to handle the duplicates. Take a look at use case #2 in this article.

Yes this is exactly what I needed.

sum(amount,[t1.parentid])/Count(t2.childid, [t1.parentid])