I have the below calculated field that is working correctly as for company id 6405 indeed it takes the max and instead of 441,262.5 I see the correct monthly amount that is 10,762.5 but when I take out the company id it goes down to 0. it is aggregated in the values field as min.
The goal here is to have a KPI that will add all the values and it will show the 25,782.5 which is the correct amount and not 456,282.5
ifelse(
{company_id} = 6405 AND (extract('YYYY', calendar) = '2025'),
maxOver({subscription_usd_revenue}, [{company_id}], PRE_AGG),
sumOver({subscription_usd_revenue}, [{company_id}], PRE_AGG)
)