# Limited time period in Canvas

**URL:** <https://discuss.elastic.co/t/limited-time-period-in-canvas/257219>\
**Category:** Kibana\
**Tags:** canvas\
**Created:** [December 1, 2020, 2:53pm UTC](https://discuss.elastic.co/t/limited-time-period-in-canvas/257219 "2020-12-01T14:53:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![axfla](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@axfla](https://discuss.elastic.co/u/axfla)\
**Post date:** [December 1, 2020, 2:53pm UTC](https://discuss.elastic.co/t/limited-time-period-in-canvas/257219/1 "2020-12-01T14:53:58Z")

</div>

Hi,

I am trying to make line graphs in Canvas based on an Elasticsearch SQL query. When I use the "preview data" button, the data is here. If I use data from the last 14 days, it works. But for some reason, if I try to make a chart based on data older than 14 days ago, I get an empty graph.

My expression is:

```auto
    filters

    | essql

    query="SELECT HISTOGRAM(\"@timestamp\", INTERVAL 30 MINUTES) AS h, COUNT(\"events.tokens.eventType\") AS number FROM \"denyall-*\" WHERE \"@timestamp\" >= CAST('2020-11-10' AS DATETIME) AND \"@timestamp\" <= CAST('2020-11-12' AS DATETIME) AND (\"context.tunnelName\" = 'something1' OR \"context.tunnelName\" = 'something2') GROUP BY h ORDER BY h"

    | pointseries x="h" y="mean(number)"

    | plot defaultStyle={seriesStyle lines="1" bars="0" points="1"}

    | render

```

The result of this query looks like this:

 ![data-preview](https://us1.discourse-cdn.com/elastic/original/3X/5/f/5f6d8aedb0d399103f5b5be20117db76eeb68932.png)

Am I doing something wrong ?

Thank you.

---

<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, 3:00pm UTC](https://discuss.elastic.co/t/limited-time-period-in-canvas/257219/2 "2020-12-04T15:00:46Z")

</div>

@axfla,  
I've just tested and this worked for me:

Simpler example I've used that worked for me:

```auto
filters
| essql 
  query="SELECT HISTOGRAM(\"@timestamp\", INTERVAL 30 MINUTES) AS h FROM \"kibana_sample_data_logs\" WHERE \"@timestamp\" >= CAST('2020-11-01' AS DATETIME) AND \"@timestamp\" <= CAST('2020-11-05' AS DATETIME) GROUP BY h ORDER BY h"
| math "unique(h)"
| metric "Days" 
  metricFont={font size=48 family="'Open Sans', Helvetica, Arial, sans-serif" color="#000000" align="center" lHeight=48} 
  labelFont={font size=14 family="'Open Sans', Helvetica, Arial, sans-serif" color="#000000" align="center"} metricFormat="0,0.[000]"
| render

```

Not sure what goes wrong in your case.  
Could you simplify your query to validate?  
What Kibana version are you using?

---

<div class="post-metadata">

**Author:** ![axfla](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@axfla](https://discuss.elastic.co/u/axfla)\
**Post date:** [December 7, 2020, 3:03pm UTC](https://discuss.elastic.co/t/limited-time-period-in-canvas/257219/3 "2020-12-07T15:03:24Z")

</div>

Hello @dosant ,

Thank you for your help. I just tried your expression and replaced the index by mine, and still faced the same issue:

 ![start-end](https://us1.discourse-cdn.com/elastic/original/3X/c/2/c2f308e545d3b100cf1bc1fbaa709fee416af229.png)

Still, the data exists, here is the data preview:

 ![preview](https://us1.discourse-cdn.com/elastic/original/3X/2/c/2c1ebfe2b717e48869bd439824c6653dcb9e2029.png)

If I remove the upper limit from the expression, I get a result, based on the last 14 days:

 ![start](https://us1.discourse-cdn.com/elastic/original/3X/d/9/d9851d7febcb87f7a43e18d510c16bde58670305.png)

I use Kibana 7.9.3.

---

<div class="post-metadata">

**Author:** ![clintandrewhall](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/clintandrewhall/32/45435_2.png) [@clintandrewhall](https://discuss.elastic.co/u/clintandrewhall)\
**Post date:** [December 9, 2020, 4:21pm UTC](https://discuss.elastic.co/t/limited-time-period-in-canvas/257219/4 "2020-12-09T16:21:29Z")

</div>

Good morning! The easiest way to debug this kind of thing is to add `render as="debug"` after each portion of the expression. So, for example:

`filters | render as="debug"` will output a JSON representation of the active filters on the page.

`filters | essql {...} | render as="debug"` will output JSON of the query results.

...etc.

This technique can help you find precisely where the problem might be. Can you give that a try?

---

<div class="post-metadata">

**Author:** ![axfla](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@axfla](https://discuss.elastic.co/u/axfla)\
**Post date:** [December 10, 2020, 3:30pm UTC](https://discuss.elastic.co/t/limited-time-period-in-canvas/257219/5 "2020-12-10T15:30:25Z")

</div>

Hello @clintandrewhall ,

Thank you for the tip, I wasn't aware of this debugging feature. Unfortunately, it made me realize someone added a time filter on another slide (we are a few people working on the same canvas), and it applied to my requests... So there is actually no problem. Again, thank you both for your help!

---

<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 7, 2021, 3:30pm UTC](https://discuss.elastic.co/t/limited-time-period-in-canvas/257219/6 "2021-01-07T15:30:35Z")

</div>

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