Weighted Average aggregation

Hi guys!

I really like how Causal allows to swap the category aggregation mechanism.

However, I find one type of aggregation really missing: That’s sort of a weighted average - DIRECTLY in the variable itself, as opposed to using a second variable to calculate the weighted average.


  • we model the number of shops we get our products into by % of shops of a given supermarket chain.
  • We therefore create a variable “% of stores” which has 2 levels of categories assigned: 1.) product, 2.) supermarket chain.
  • We have another variable hat holds the total number of shops for each chain.
  • So if we plan to have Product A in 15% of stores of chain X and 30% of stores of chain Y, it would be fantastic to directly see in the aggregation of our % of stores variable, what percentage we actually achieve overall across all chains.
  • For that we’d have to calculate (15% * total_stores(X) + 30% * total_stores(Y)) / total_stores

That, however doesn’t seem to be possible to put as a aggregation-level formula in a variable that serves as direct value-entry.

My preferred solution here would be to be able to define the formula for the aggregate level even if i’m entering values at the detail level directly.

Or am I overlooking something how I can do this straight in my “% of stores” variable already ?

Thank you & Best Regards

Hey Fabian :grinning_face_with_smiling_eyes:

Totally get what you’re trying to achieve. However I think it would be difficult to do all of it in one variable.

I’ve broken out the different components in a model here.

  • It sounds like you input products as a % of chain X’s total stores.
  • You then have another input that is the total number of stores, by chain.
  • The product of these two input variables gives you the number of stores that each product is in, for each chain.
  • The final variable is the % that each product makes up of the total stores for all chains.

Am I understanding all of that correctly?

Hi @heidi_causal

I can’t access the model you linked - only the cards view which doesn’t show me all the details. Can you exten the sharing rights please ? (or send me a full-edit via PM / support chat) ?

Thank you & Best Regards

Just emailed a link to you :slight_smile:

1 Like

Hi @heidi_causal ,

thanks for the link!

That’s exactly right - however, since there are a ton of such variables, it’s a pity that the weighted averages aren’t displayed “in place” on the aggregation level, but you have to find yet another variable to keep an eye on that.

Thank you & Best Regards

Hey @FabianK - I think it would be hard to display it in place all in one variable as the weighting amounts for each category item will always be a separate variable. I’ll have a chat with our product team though and see if we can come up with something :slight_smile: