# Use specific subsets of data for visualization layers

**URL:** https://discuss.elastic.co/t/use-specific-subsets-of-data-for-visualization-layers/347945
**Category:** Kibana
**Created:** [November 24, 2023, 4:28pm UTC](https://discuss.elastic.co/t/use-specific-subsets-of-data-for-visualization-layers/347945 "2023-11-24T16:28:01Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![greendrake](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/greendrake/32/128006_2.png) [@greendrake](https://discuss.elastic.co/u/greendrake)
#### Post date: [November 24, 2023, 4:28pm UTC](https://discuss.elastic.co/t/use-specific-subsets-of-data-for-visualization-layers/347945/1 "2023-11-24T16:28:02Z")

</div>

There is a nice feature in Kibana (I am using v 8.6.2) which allows to add multiple **layers** to visualizations:

![Screenshot from 2023-11-25 05-15-46](https://us1.discourse-cdn.com/elastic/original/3X/5/7/570343a379cc7909827502a790b6bfe263207c6f.png)

I have the following kind of data in the index:

```auto
{
    utc: "<datetime>",
    source: "foo",
    value: 5
},
{
    utc: "<datetime>",
    source: "bar",
    value: 6
},
{
    utc: "<datetime>",
    source: "foo",
    value: 4
},

```

That is, some metric value is coming from 2 different sources, indexed by datetime.

What I'd like to do is first visualize median values coming from source "foo" only in the 1st layer, then on the 2nd layer — values coming from source "bar". Finally, the graph will show stacked bars telling me which source contributes how much to the total cumulative value from both sources. (The real sources are solar panel arrays, and the values are the power they generate at the specified datetimes).

How can one achieve that? Which parameters need to be set to filter the data for each layer by the `source` field?

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [November 24, 2023, 5:56pm UTC](https://discuss.elastic.co/t/use-specific-subsets-of-data-for-visualization-layers/347945/2 "2023-11-24T17:56:22Z")

</div>

Is the data in the same index? or 1 different indices?

If in one Indices / Data View

You should simply be able to  
Bar Chart Stacked  
average(`value`)  
breakdown by `source`

In this case my case your `value` is `system.load.1` and the breakdown your `source` is `host.name

 ![Screenshot 2023-11-24 at 9.55.04 AM](https://us1.discourse-cdn.com/elastic/original/3X/7/3/736eb043195b32f49c33359d767ea23528aec437.jpeg)

---

<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: [December 22, 2023, 5:57pm UTC](https://discuss.elastic.co/t/use-specific-subsets-of-data-for-visualization-layers/347945/3 "2023-12-22T17:57:01Z")

</div>

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