# Splitting a field value based on other field

**URL:** <https://discuss.elastic.co/t/splitting-a-field-value-based-on-other-field/244887>\
**Category:** Kibana\
**Created:** [August 13, 2020, 1:20pm UTC](https://discuss.elastic.co/t/splitting-a-field-value-based-on-other-field/244887 "2020-08-13T13:20:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![subash](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/subash/32/59912_2.png) [@subash](https://discuss.elastic.co/u/subash)\
**Post date:** [August 13, 2020, 1:20pm UTC](https://discuss.elastic.co/t/splitting-a-field-value-based-on-other-field/244887/1 "2020-08-13T13:20:52Z")

</div>

I have an index having the below fields

1. Time (every 5 minutes)
2. MetricType Name (having values **Inbound traffic** , **Outbound traffic** )
3. Metric Value (values for Inbound and Outbound traffic)

I want to plot a Line graph having Time in the X axis and 2 lines plotting Inbound and Outbound metric values.

Please help me to achieve this.

Regards  
Subash

---

<div class="post-metadata">

**Author:** ![markov00](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/markov00/32/33316_2.png) [@markov00](https://discuss.elastic.co/u/markov00)\
**Post date:** [August 13, 2020, 3:26pm UTC](https://discuss.elastic.co/t/splitting-a-field-value-based-on-other-field/244887/2 "2020-08-13T15:26:57Z")

</div>

Hi, you can use Lens for that: just drag the time field on the central area chart, drag the Metric Value field into the Y axis field on the right (adjust the aggregation to your needs, like sum, count etc) and then drag the MetricTypeName field to the breakdown by using the `top value` function.  
This should lead to the result you are looking for.

 ![Screenshot 2020-08-13 at 17.23.26](https://us1.discourse-cdn.com/elastic/original/3X/1/2/120d1288b1a61a75cce1b11715cebd90d7b42fae.png)

If you want to the legacy Line chart, available on the Visualize chart type panel, you can do that in a similar way: select your MetricValue and it's aggregation on the Metrics panel, then a Date Histogram on the Buckets panel and finally click on `split series` and specify a terms aggregation over MetricType Name to split to have two different set of metrics depending on the MetricType Name

---

<div class="post-metadata">

**Author:** ![subash](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/subash/32/59912_2.png) [@subash](https://discuss.elastic.co/u/subash)\
**Post date:** [August 25, 2020, 7:37am UTC](https://discuss.elastic.co/t/splitting-a-field-value-based-on-other-field/244887/3 "2020-08-25T07:37:19Z")

</div>

Thanks a lot @markov00. It works

---

<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:** [September 22, 2020, 7:37am UTC](https://discuss.elastic.co/t/splitting-a-field-value-based-on-other-field/244887/4 "2020-09-22T07:37:22Z")

</div>

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