Pie chart with filtering

Hello, everyone.
I am trying to create a pie-chart based on the below data, but I am pretty sure that it can only be don with Vega, not with a regular pie-chart. However, I thought I could ask this question, see if anyone can help.
So, for the following data:
image

I would like to have a pie-chart with the following results:

image

Any possibility of achieving this results using a regular pie-chart?
Thanks in advance for your help.

Hi there, you could achieve it using filters aggregation on lens or regular pie chart visualization, here's the example (filters where one uses and operator):

Hello, Marta.
Thanks for your reply. Unfortunately, the data that you used is not structured is the same way as mine. In your example, you could have multiple instances of category.keyword in the same record (basically, multiple products of different types). For my example, imagine that I have just one occurence of category.keyword in my record.

To use your data in my example, let's assume a customer bought a product from "Men's accesories" and one product from "Men's clothing". In my example, this would produce 2 records, each one with its own category.keyword field (see below an example of what I am reffering to):

  {
        "_index" : "kibana_sample_data_ecommerce",
        "_type" : "_doc",
        "_id" : "2-dm8nsBcBtKmSN2zsMN",
        "_score" : 0.0,
        "_source" : {
          "currency" : "EUR",
          "customer_first_name" : "Sultan Al",
          "customer_full_name" : "Sultan Al Thompson",
	      "category" : "Men's Clothing",
          "customer_gender" : "MALE",
          "customer_id" : 19,
          "customer_last_name" : "Thompson",
          "customer_phone" : "",
          "day_of_week" : "Tuesday",
          "day_of_week_i" : 1,
          "email" : "sultan al@thompson-family.zzz",
        }
      },
     {
        "_index" : "kibana_sample_data_ecommerce",
        "_type" : "_doc",
        "_id" : "2-dm8nsBcBtKmSN2zsMN",
        "_score" : 0.0,
        "_source" : {
          "currency" : "EUR",
          "customer_first_name" : "Sultan Al",
          "customer_full_name" : "Sultan Al Thompson",
		  "category" : "Men's Accessories",
          "customer_gender" : "MALE",
          "customer_id" : 19,
          "customer_last_name" : "Thompson",
          "customer_phone" : "",
          "day_of_week" : "Tuesday",
          "day_of_week_i" : 1,
          "email" : "sultan al@thompson-family.zzz",
        }
      }

So, for my example, this client would have to be labeled as "Hybrid" in my pie-chart.

For my final pie-chart I have to count:

  1. How many customers bought products from both "Men's acessories" and "Men's clothing" - these customers are Hybrid.
  2. How many customers bought only from "Men's acessories"
  3. How many customers bought only from "Men's clothing".

Thanks.
Alex

Understood. Yes, I am afraid in this case only Vega would suit your needs.

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