# Help for comparation dates with visual builder visualization

**URL:** <https://discuss.elastic.co/t/help-for-comparation-dates-with-visual-builder-visualization/170733>\
**Category:** Kibana\
**Created:** [March 4, 2019, 1:56pm UTC](https://discuss.elastic.co/t/help-for-comparation-dates-with-visual-builder-visualization/170733 "2019-03-04T13:56:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jorjao](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@jorjao](https://discuss.elastic.co/u/jorjao)\
**Post date:** [March 4, 2019, 1:56pm UTC](https://discuss.elastic.co/t/help-for-comparation-dates-with-visual-builder-visualization/170733/1 "2019-03-04T13:56:35Z")

</div>

I have this data:

 ![filtro_tarefas](https://us1.discourse-cdn.com/elastic/original/3X/c/7/c7d299d9ca45b0596f50ac206bef7846289d40a7.png)

I use this filter:

> {  
> "query": {  
> "bool": {  
> "filter": [  
> {  
> "script": {  
> "script": "doc['endTime'].date.isAfter(doc['due'].date)"  
> }  
> }  
> ]  
> }  
> }  
> }

i would like build a visualization where i count how many tasks endTime is after dueDate (due).  
I use visualbuilder where i have two aggregation (one count and other is filter radio). But if i define numerator endTime:\>due the result is 0. Is not correct.

 ![filtro_tarefas_VISUALIZE](https://us1.discourse-cdn.com/elastic/original/3X/b/e/be7271a2477d3d3ef40613843eeca78aa81d2a7d.png)

what i do wrong?

if i use other numerator work well. Example duration:\>0

 ![dados_analiser](https://us1.discourse-cdn.com/elastic/original/3X/a/7/a7c778815232d065d0b073267470e0868da143e9.png)

---

<div class="post-metadata">

**Author:** ![Nathan\_Reese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_reese/32/84829_2.png) [@Nathan\_Reese](https://discuss.elastic.co/u/Nathan_Reese)\
**Post date:** [March 5, 2019, 5:47pm UTC](https://discuss.elastic.co/t/help-for-comparation-dates-with-visual-builder-visualization/170733/2 "2019-03-05T17:47:12Z")

</div>

I would recommend creating a [scripted field](https://www.elastic.co/guide/en/kibana/current/scripted-fields.html) to create a computed field `isPastDue`. That way, you can just use the scripted field in any visualization.

---

<div class="post-metadata">

**Author:** ![jorjao](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@jorjao](https://discuss.elastic.co/u/jorjao)\
**Post date:** [March 6, 2019, 11:20am UTC](https://discuss.elastic.co/t/help-for-comparation-dates-with-visual-builder-visualization/170733/3 "2019-03-06T11:20:43Z")

</div>

Thanks a lot for your response. work in any visualization!

In future is possible use scripted field in TSVB (Visual Builder) ?

---

<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:** [April 3, 2019, 11:20am UTC](https://discuss.elastic.co/t/help-for-comparation-dates-with-visual-builder-visualization/170733/4 "2019-04-03T11:20:46Z")

</div>

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