# Line Chart - How to filter for one single Term

**URL:** <https://discuss.elastic.co/t/line-chart-how-to-filter-for-one-single-term/324983>\
**Category:** Kibana\
**Created:** [February 8, 2023, 8:06am UTC](https://discuss.elastic.co/t/line-chart-how-to-filter-for-one-single-term/324983 "2023-02-08T08:06:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tinrik](https://avatars.discourse-cdn.com/v4/letter/t/d78d45/32.png) [@tinrik](https://discuss.elastic.co/u/tinrik)\
**Post date:** [February 8, 2023, 8:06am UTC](https://discuss.elastic.co/t/line-chart-how-to-filter-for-one-single-term/324983/1 "2023-02-08T08:06:02Z")

</div>

Hi,

I have a dataset where files can belong to categories `a` and `b` that looks like follows:

```auto
{ file: foo, category = [a], value = 123, timestamp = 1 }
{ file: bar, category = [a, b], value = 321, timestamp = 1 } 
...

```

I am displaying a line chart over time of the sum of `value` across all files for each category, so 2 lines are displayed (one for category `a`, one for category `b`).

The problem comes when the user wants to filter only for category `a`: the expectation is to see only 1 line (category `a`), but the line for category `b` still remains, due to the fact that there is a document for which `category = [a, b]`.

Is it possible to configure the Line Chart (Lens or Aggregation-based) to only display 1 line when the user filters for a given category?

One solution is to send _normalized (flattened) data_ instead, but this leads to `value` being duplicated and so the sum is incorrect.

Thanks!

---

<div class="post-metadata">

**Author:** ![Marco\_Liberati](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marco_liberati/32/82953_2.png) [@Marco\_Liberati](https://discuss.elastic.co/u/Marco_Liberati)\
**Post date:** [February 8, 2023, 10:29am UTC](https://discuss.elastic.co/t/line-chart-how-to-filter-for-one-single-term/324983/2 "2023-02-08T10:29:15Z")

</div>

Hi @tinrik

how are you breaking down categories in the chart? Are you using a Top values or explicit Filters?

---

<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 8, 2023, 10:29am UTC](https://discuss.elastic.co/t/line-chart-how-to-filter-for-one-single-term/324983/3 "2023-03-08T10:29:37Z")

</div>

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