# Visualizations and Subqueries

**URL:** <https://discuss.elastic.co/t/visualizations-and-subqueries/74706>\
**Category:** Kibana\
**Created:** [February 10, 2017, 7:39pm UTC](https://discuss.elastic.co/t/visualizations-and-subqueries/74706 "2017-02-10T19:39:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gefisher](https://avatars.discourse-cdn.com/v4/letter/g/a587f6/32.png) [@gefisher](https://discuss.elastic.co/u/gefisher)\
**Post date:** [February 10, 2017, 7:39pm UTC](https://discuss.elastic.co/t/visualizations-and-subqueries/74706/1 "2017-02-10T19:39:05Z")

</div>

Is it possible to make one visualization in a dashboard, to be filtered based the outcome of a second query? (An dynamic filter that is visualization specific?)

For example, let's say I have a dimension called "fruit" and a second dimension called "country". My data in ES looks like this:  
{  
fruit: apple,  
country: canada  
},  
{  
fruit: banana,  
country: japan  
},  
{  
fruit: apple,  
country: france  
}

I have a pie chart (A) that shows the count per fruit, ordered by fruit. So the data it contains will; be apple: 2, banana: 1  
I have a second pie chart (B) that shows the count per countries. So the data it contains will be canada: 1, france: 1, japan: 1

I would like pie chart B to only show the TOP 1 fruit, equivalent to if I pivoted the entire dashboard by fruit: apple. but rather dynamically, and specific to a visualization. In this example, the subquery would determine what is the TOP 1 fruit by count at that time. In pie chart B, this would automatically apply the pivot fruit:apple to the visualization B, resulting in it showing canada: 1, france: 1, removing the need for users to filter the entire dashboard.

I am aware of the "split slices" feature, I'm trying to solve a more general problem. Is this possible in Kibana?  
(For example, another use case would be to show only the latency of the least reliable component in a visualization.)

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 10, 2017, 10:30pm UTC](https://discuss.elastic.co/t/visualizations-and-subqueries/74706/2 "2017-02-10T22:30:36Z")

</div>

> [@gefisher](#):
>
> Is it possible to make one visualization in a dashboard, to be filtered based the outcome of a second query? (An dynamic filter that is visualization specific?)

Not at this stage, no.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 10, 2017, 10:31pm UTC](https://discuss.elastic.co/t/visualizations-and-subqueries/74706/3 "2017-03-10T22:31:34Z")

</div>

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