Claim (1 to N) Procedures ( 1 to 1 ) Charges
(1 to N) Payments
(1 to N) Adjustments
To get the charges of claim, I do a sumOver(charges, [{claim_id}], PRE_AGG). The charges are getting multiplied by the number of payments and adjustments for that claim (table below).
You are not doing anything wrong in the expression itself your dataset grain is the issue.
All rows in your visual are at the claim * procedure * payment/adjustment level. So, each charge row is duplicated once for every payment/adjustment row. sumOver(charges, [{claim_id}], PRE_AGG) just sums all those duplicated values, so you get 130 * 8 = 1040.
If charges is constant per claim (or per claim+procedure), use a min/max at the claim level instead of sumOver.
@Xclipse this is working on a claim level. How do I use the ClaimCharges to generate a total sum for all claims on my dataset? Using sumOver or simply adding the ClaimCharges filter will generate the same issue as before.