Why timespan value "all" needs aggregation across categories?


in a formula calling only time-distributed variables with same categories, why it is not possible to sum each category separatedly using the “all” time modifier option?

For example:
Consider v1, v2, v3 and v4 with values distributed along a year and having categories A and B.
Why its prohibited to write: "(v1{cat:all}{time:all}+v2{cat:all}{time:all}+v3{cat:all}{time:all})/v4{cat:all}{time:all} "? I would expect to have as a result a variable inheriting the categories from the formula, with “A” and “B” having absolute values from the sum of the v1, v2, v3 and v4 across the year by selecting “{time:all}”. But this is not possible.

I was expecting to use the categories “power” to concisely write a formula expression that, at the same time, does math operations and transforms time spanned variables in absolute values of a sum of each category item separately.

One way to do what I want is creating new sum-up variables from the time-spanned result of using {time:current} instead of {time: all} in the previous example. But I wonder why I couldn’t do that more elegantly.

Thanks in advance for any tip on that!

Hi @OttoHeringer,
I agree this is a bit inconsistent right now. Ideally, v1{time:all} would use the time aggregation function of v1. Currently, you have to write sum(v1{time:all}) or avg(v1{time:all}).

I’m sure we’ll update this eventually but it requires a fair amount of work because we have to migrate all old models to the new behaviour.

Hi Lukas, thanks for the fast reply, man!

I though the problem was on me not understanding correctly how the categories are working, this way I can just go ahead and do things alternatively.

Your suggestion worked fantastically. Thanks!

For the ones with similar questions, this was my issue and the solution, more explicitly:

Hope might help others

My specific application was to calculate the cost fraction per product of a group of product components, but doing that through a batch category, anticipating the same calculation for other future batches.

1 Like