The annotated code below will perform the calculation it in the script. Once reloaded the result table will look like:

Ill check if calculation in the UI is possible
RawData:
Load * inline [
Month, Customer Name, Paid, Collected, Actual
1 , John Smith , 100 , 1000 , 10%
2 , John Smith , 200 , 1050 , 19%
3 , John Smith , 300 , 1100 , 27%
1 , Kirk Polly , 250 , 1150 , 22%
2 , Kirk Polly , 355 , 1200 , 30%
3 , Kirk Polly , 865 , 1250 , 69%
];
// Find the max month for each [Customer Name]
MaxMonth:
Load
max(Month) as Month,
[Customer Name]
Resident
RawData
Group By
[Customer Name]
;
// left join the RawData to get the Collected amount
// for the max month
// name the field MaxMonthCollected
left join
Load
Month,
[Customer Name],
Collected as MaxMonthCollected
Resident
RawData
;
// join the resulted table (MaxMonth) back to RawData table
// this way agains each row we'll have the max Collected amount
// (based on the [Customer Name]
join (RawData)
Load
[Customer Name],
MaxMonthCollected
Resident
MaxMonth
;
// We dont need this table anymore
Drop Table MaxMonth;
// Calculate "Paid / MaxMonthCollected" and name the field "Result"
// at this point the next steps might not be needed
// we have the "MaxMonthCollected" field in "RawData" table so
// we can perform the calculation in UI expression
FinalData:
Load
*,
Paid / MaxMonthCollected as Result
Resident
RawData
;
Drop Table RawData;
Drop Field MaxMonthCollected; // MaxCollected can be dropped if not needed
UPDATE
Something like the expression below can be used directly in the table.
Bit of a warning. Its a heavy calculation! Running it against large dataset can/will lead to performance issues!
sum(Paid)
/
aggr( nodistinct
Sum( {$< Month={"$(=aggr(Max(Month), [Customer Name]))"} > } Collected),
[Customer Name]
)
