Calculated field doubling up per month

I have this calculated field that gives me the below table but the issue is that is doubling up the volumes for the two months.
The codded amounts for example for id 6446 should be 2040, for 6644 should be 1500 etc.

min(minOver({prorated_monthly_fixed_USD}, [{company_id}], PRE_AGG),[{company_id}])

Hello @pantelis

Would you be able to show a few rows of anonymized data? That would help me understand how this is being calculated better.

That being said you probably need to also partition this by date as well as company_id.

1 Like

Hello @pantelis

Are you able to share more about how your dataset is structured?