Hi,
I am trying to create a table in Kibana Lens (8.13) to calculate statistics for some products. In particular, for each month and product type, I would need to calculate the number of products considered and the percentage breakdown for each month (i.e. the sum of all percentages for that specific month must add up to 100).
The problem arises on this last statistic: I have tried using the formula count() / overall_sum(count())
However, overall_sum
sums all products in that specific category for all the months. for instance:
ACTUAL
date | product_type | count() | count() / overall_suim(count())
2025-01-01 1 | 6 | 33%
2025-01-01 2 | 7 | 70%
2025-01-01 3 | 8 | 50%
2025-02-01 1 | 12 | 67%
2025-02-01 2 | 3 | 30%
2025-02-01 3 | 8 | 50%
EXPECTED
date | product_type | count | count() / overall_suim(count())
2025-01-01 1 | 6 | 29%
2025-01-01 2 | 7 | 33%
2025-01-01 3 | 8 | 38%
2025-02-01 1 | 12 | 52%
2025-02-01 2 | 3 | 13%
2025-02-01 3 | 8 | 35%
As you can see, for each month, the sum of the percentages is equal to 100%.
Is there a way to get these results?
Thank you,