# Visualize a time counter

**URL:** <https://discuss.elastic.co/t/visualize-a-time-counter/257225>\
**Category:** Kibana\
**Created:** [December 1, 2020, 3:22pm UTC](https://discuss.elastic.co/t/visualize-a-time-counter/257225 "2020-12-01T15:22:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![fastxl](https://avatars.discourse-cdn.com/v4/letter/f/85e7bf/32.png) [@fastxl](https://discuss.elastic.co/u/fastxl)\
**Post date:** [December 1, 2020, 3:22pm UTC](https://discuss.elastic.co/t/visualize-a-time-counter/257225/1 "2020-12-01T15:22:19Z")

</div>

I am new to the ELK stack and trying to learn how to visualize some things. I have data coming in from one of our machine tools and I would like to make a simple counter that show the amount of time the machine has been running for a given time period my document looks like this.  
`@timestamp Nov 30, 2020 @ 18:51:11.217`  
`@version 1`  
`Samples.AccumulatedTime.@@data 1.98`  
`Samples.AccumulatedTime.name p1CuttingTime`  
`Samples.AccumulatedTime.subType x:CUTTING_TIME`  
`_id IDjIG3YBNhsRe95vKY52`  
`_index mtconnect-demo`  
`_score -`  
`_type _doc`  
`componentId Mp1`  
`dataItemId Mp1CuttingTime`  
`deviceName OKUMA.MachiningCenterMA650-EAST`  
`deviceUUID OKUMA.MachiningCenterMA650-EAST.190056`  
`host mt-data-01`  
`sequence 6,829,939`  
`timestamp Nov 30, 2020 @ 18:48:56.714`  
`type json`

I know I can get a COUNT of the p1CuttingTime but how do I get the value of the Samples.AccumulatedTime.@@data that goes along with p1CuttingTime? Any help would be appreciated as well as pointers to any tutorials on working with Visualizations

---

<div class="post-metadata">

**Author:** ![dosant](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dosant/32/64489_2.png) [@dosant](https://discuss.elastic.co/u/dosant)\
**Post date:** [December 3, 2020, 12:27pm UTC](https://discuss.elastic.co/t/visualize-a-time-counter/257225/2 "2020-12-03T12:27:26Z")

</div>

Hi @fastxl,  
As I understood you want to sum up `Samples.AccumulatedTime.@@data` from your documents?  
Then you should use sum aggregation for this.

For example, using Lens:

1. Drop `Samples.AccumulatedTime.@@data` field into editor
2. Pick "metric" chart type
3. Pick a "sum" function

---

<div class="post-metadata">

**Author:** ![fastxl](https://avatars.discourse-cdn.com/v4/letter/f/85e7bf/32.png) [@fastxl](https://discuss.elastic.co/u/fastxl)\
**Post date:** [December 3, 2020, 8:19pm UTC](https://discuss.elastic.co/t/visualize-a-time-counter/257225/3 "2020-12-03T20:19:00Z")

</div>

Thanks for the direction it has helped. However `Samples.AccumulatedTime.@@data` holds other data as well for other values. So just displaying the SUM of it doesn't give me what I want. I need to display the SUM of `Samples.AccumulatedTime.@@data` when `Samples.AccumulatedTime.name p1CuttingTime`. Not sure how to do that.

---

<div class="post-metadata">

**Author:** ![dosant](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dosant/32/64489_2.png) [@dosant](https://discuss.elastic.co/u/dosant)\
**Post date:** [December 4, 2020, 9:10am UTC](https://discuss.elastic.co/t/visualize-a-time-counter/257225/4 "2020-12-04T09:10:37Z")

</div>

@fastxl, can you sum up all `Samples.AccumulatedTime.@@data` and then use Kibana's filter to include only documents with `Samples.AccumulatedTime.name:p1CuttingTime` ?

I am talking about this filter bar:

![Screenshot 2020-12-04 at 10.10.17](https://us1.discourse-cdn.com/elastic/original/3X/e/6/e6923d9629a944bc224f20b0349c6d3d682799ef.png)

---

<div class="post-metadata">

**Author:** ![fastxl](https://avatars.discourse-cdn.com/v4/letter/f/85e7bf/32.png) [@fastxl](https://discuss.elastic.co/u/fastxl)\
**Post date:** [December 4, 2020, 7:47pm UTC](https://discuss.elastic.co/t/visualize-a-time-counter/257225/5 "2020-12-04T19:47:03Z")

</div>

Yes! That worked. I didn't realize that the filters would stay with the visualization. Thank you for the direction.

---

<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:** [January 1, 2021, 7:47pm UTC](https://discuss.elastic.co/t/visualize-a-time-counter/257225/6 "2021-01-01T19:47:19Z")

</div>

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