Calculation of percentages

Hello!
I am somewhat of a newbie to Kibana. I'm not sure how to calculate percentages.
I tell you my problem with a simple example.
I have candies of different flavors bought in different stores. I have already eaten some of those candies.

My data could be:

STORE --- FLAVOR ---------- BOUGHT ------ EATEN

Store1 --- Lemon ----------10 ------------------ 2
Store1 --- Strawberry ------6 ------------------ 3
Store1 --- Mint ------------- 4 ------------------ 1
Store2 --- Lemon ---------- 5 ------------------ 1
Store2 ---Strawberry------- 6 ------------------ 4
Store3 --- Lemon ----------- 5 ------------------ 3
Store3 ---Strawberry -------8 ------------------ 2

Overall ----------------------- 44 ------------------16

How could you show the percentage of candies eaten out of the total candies bought?
That is: (16*100) / 44 = 36.4%

How could you show the total lemon candies from store1 eaten versus the total candies purchased?

That is: (2*100)/44 =4.5%

How could you show the total number of lemon candies from the store1 eaten versus the lemon candies purchased?

That is: (2*100)/20 =10%

Thanks for your help

I suppose using Formula with Lens is a good way to visualize such data.

  • store1 eaten versus the total candies purchased


  • the percentage of candies eaten out of the total candies bought

  • lemon candies from the store1 eaten versus the lemon candies purchased

The last one is a bit tricky because there is no function to sum by dimention made by top_value.

If you have data with the following structure:
STORE --- FLAVOR ---------- BOUGHT ------ EATEN
Store1 --- Lemon ----------10 ------------------ 2

STORE --- FLAVOR ---------- EATEN ------ COUNT
Store1 --- Lemon ----------EATEN ------------------ 2
Store1 --- Lemon ----------NOT_EATEN ------------------ 8

You can use more flexible visualizations like Pie chart.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.