How to create a weighted distribution

  • 2 February 2024
  • 1 reply



I have a sales volumes metric with dimensions Category, Channel, Product and Month.

Data was imported from a transaction list.

I want to adjust this with some volumes that are manually input by user per channel, but I want to spread this values on every product using the same weighted distribution per category and month as the initial data. For example, if on month Jun, on a product, the volume was 15% of the total, I want to add on that product for Jun 15% of the manually added volume.

How do I achieve that?

Thanks in advance!


Best answer by Stephen Phan 7 February 2024, 23:26

View original

1 reply

Userlevel 2
Badge +2

Pigment’s dimensionality helps a lot with this kind of calculation. Try creating three metrics:

First, one metric that calculates the percent of the product’s mix of total product volume by each dimension:
Sales_volume / Sales_volume[remove: Product]

Second, a metric that takes your user input on the n number of dimensions to the same dimensions as the initial data. So if the user inputs only on the channel, you can spread that value across all applicable dimensions using a [by constant:] allocation.
User_input[by constant: Category, Product, Month]
If the user input is on channel per month, you would just remove the Month dimension from the allocation above, etc.

And the last metric, which multiples the above two metrics (which now have the same metric structure of four dimensions).