How to combine aggregations in new calculated field?

I have a list of customer IDs and calculated an amount owing based on 2 columns (accounts receivable customer)
Based on how long a customer is owing the amount they are assigned to a class (PAR class).

Now, I can visualise class and individual accounts receivable, see screenshot. What I actually want to get to is a total (SUM) of accounts receivable per class in a new calculated field or, ideally, combining, this all. However, whatever I tried results in QS complaining that I am trying to nest aggregations and cant do that.
The challenge is that on a dataset level, each customer might appear multiple times, therefore the totals for accounts receivable are multiples on the amount of times the customer appears in the list.

add: As customer appears multiple times, I calculate the accounts receivable like this:


Hello @wrompf, Happy New Year! Do we need to always select the maximum of Unlock Proce and then subtract it from the correpsoinding Total Paid column to get the accounts receivable for a customer record? Is it possible to share a sample of your dataset with only the relevant columns and expected value. That would really help!

Thanks for your feedback!
Unlock price - paid amount = accounts receivableis a fixed calculation,both values come from separate columns, no max need to be selected here.
But because the same accounts receivable appears multiple times in the table as customer is listed with multiple entries, I select the max value for each customer to get a unique accounts receivable. Would work the same way with MIN or AVG.
The issue starts when wanting to aggregate those unique accounts receivable values per customer segment (PAR class).

Hi @wrompf,

Could you let us know if you found a solution ? . If not, is it possible to share a sample of your dataset with only the relevant columns and expected value ?