Conditional calculated field showing incorrect totals and subtotals

Hello, I have a conditional calculated field on the lines of (if metric_name = abc, then do x/y or else metric_value). In this case metric_value is a calculated field with it’s own formula. I am using this field in a pivot table with some attributes.

I am doing it this way because I want the calculation formula to be different for just one metric. It works great for granular data for that metric as well as others. But as I added totals and subtotals, it seems something goes wrong. My pivot table is on a date field, so my value columns are by month.

I see 2 months with the correct and expected calculation based on the new field and specific metric, while some other months (columns) show totals based on the older formula that is used in the else part of the calculated field.

Has anyone faced something like this before?
Any help is appreciated, thank you!

Hi @gon_may Can you provide more context? Perhaps screenshots of the before and after of adding totals, as well as the calculation itself.