Problem with a LAC calc

Yes, you are on the right path to partition by the fields.

Can you check out a similar solution I shared earlier? I recall, the use case was close to what you mention here.

Or if you can mock up some data to try out, I can give that a try. Based on what is your data granularity, the aggregations will also vary.