Subquery Factoring in Kibana


I have a technical issue with a report and wanted to get some help.

I want to select the top10 products by sales ranking for the most recent week, and for that subset (say top 10 products). I would like to see how the rankings were for past 3 months.

So I should first filter the top 10 products by sales rank and most recent week and then pass that list to the line graph and draw the ranking for those 10 products for past 3 months.

How can I achieve this?

Thanks in advance.

Hi @tenet_testuser1,
I am not quite sure if I understand your question but let me try to respond. You need to configure a line chart with a time picker of 3 months. On Y-axis, configure the metric you're interested in measuring (Count?)
On X-axis, select Date histogram on timefield. Add split series by products ordered by whatever condition that defines them as top10 (count, sum etc)
Here's the similar setup, let me know if it helps:


Thanks. This is not what I am looking for.
After exhaustive research I came to a conslusion that ES will not support what I want.
I will explain anyway.

I want to pick top 5 products by sales as of TODAY. Then for those 5 products I want the sales count for past 6 months. Similarly, I want to be able to run this report for any day in the past month.

So to give data example:

Assume today is 2020-aug-01, then pick top 5 products as of aig-01-2020, and show their sales data between feb-01 till aug-01
If the date I picked was 2020-jul-25, then pick top 5 prodcuts as of 2020-jul-25 and for these prodcuts
show me the sales data between 2020-jan-25 till 2020-jul-25

Thanks for explanation @tenet_testuser1. I'll try to see if it's possible to achieve it in Vega - let me get back to you :slight_smile:

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