Aggergation with condition

Hi,
Assume that i have personal details (names / adderess / phones / age and etc) of city people

I need to build Table Visualization in Kibana 7 based on those details.
The visualization should display the following fields :
The issue is related to the last coulm : "Average age over 13"

CityName    |  Total population     | Avg age over 13 year
=======================================
New Yoark   |      19,000,000       |              28
Paris             |     10,000,000        |              36

Step I have took :
--Metric --> Aggregation : count
Buckets --> split rows --> terms --> Field:CityName Order by Count

Now i have added second metric :
--Metric -->Aggregation:Average , Field : AGE , Order by Count

The above steps shows the population of each city and it avg. population age.
I need to display the avevarge age ABOVE 13 year .
Please advise

Thanks

You can just filter out documents for people with age 13 and lower by adding this in the query bar of the visualization:
AGE:>13
Then the average will be done for people older than 13.

Hi,
From checks that i have done FILTERS in the search bar is take affect on all the aggregation.
I mean : Its also effect the "count" metric of the second column "Total population".
I get a different "Total population" when changing the filter from 13 to some other value.
The value of "Total population" shouldnt change. It not depend on the avg age
Any suggestion ?
Thanks

Ok, I see what you mean there. Yeah, there is no way of doing this in one single visualization in Kibana. Filters in Kibana are pretty tightly coupled to the aggregation query it generates. You can add multiple metrics and aggregations in a single request, and thus a single visualization, but any filters will apply to the entire request.
The only solution i see here is to use 2 visualizations on a dashboard, this way you'll get both metrics side by side.

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