# Timelion throws error while querying on empty data

**URL:** <https://discuss.elastic.co/t/timelion-throws-error-while-querying-on-empty-data/245223>\
**Category:** Kibana\
**Tags:** timelion\
**Created:** [August 17, 2020, 11:11am UTC](https://discuss.elastic.co/t/timelion-throws-error-while-querying-on-empty-data/245223 "2020-08-17T11:11:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Castor](https://avatars.discourse-cdn.com/v4/letter/c/ba9def/32.png) [@Castor](https://discuss.elastic.co/u/Castor)\
**Post date:** [August 17, 2020, 11:11am UTC](https://discuss.elastic.co/t/timelion-throws-error-while-querying-on-empty-data/245223/1 "2020-08-17T11:11:07Z")

</div>

Hello  
I am trying to calculate total x value divided by total y value in percentage.

`.es(q="*",metric=sum:x.value,split=element.name:10).cusum().divide(.es(q="*",metric=sum:y.value, split=element.name:10).cusum()).multiply(multiplier=100).label(regex='.* element.name:(.*) > .*', label='$1')`

But i get this error while selected timerange has no data:

`[timelion_vis] > Timelion request error: Error: in cell #1: Cannot read property 'data' of undefined Error: in cell #1: Cannot read property 'data' of undefined`

By try and error I manged to find out that removing one of split statement in any query removes error but then I get incorrect results.  
How can I remove this error and still get correct data?

---

<div class="post-metadata">

**Author:** ![monfera](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/monfera/32/26467_2.png) [@monfera](https://discuss.elastic.co/u/monfera)\
**Post date:** [August 20, 2020, 8:08am UTC](https://discuss.elastic.co/t/timelion-throws-error-while-querying-on-empty-data/245223/2 "2020-08-20T08:08:21Z")

</div>

Hi Castor, there had been some similar `timelion` issues erroring `undefined` with the special case of no data, eg. [with the fit function](https://github.com/elastic/kibana/issues/10236#issuecomment-298944337) which got fixed since. Please consider a workaround for filling in data analogously to the tip in this gh issue, and please file an issue in the Kibana repo as it looks like a bug.

On the offchance you're a developer, or work with one who can check out the Kibana repo, it'd be appreciated if you could triage the issue and if unhandled empty set is the culprit, consider submitting a PR. For example, the fix for `fit` turned out to be a [five-liner change](https://github.com/elastic/kibana/pull/14560/files) plus some tests. If you do so, please mention your github issue and/or PR link here in this discussion.

---

<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:** [September 17, 2020, 8:08am UTC](https://discuss.elastic.co/t/timelion-throws-error-while-querying-on-empty-data/245223/3 "2020-09-17T08:08:28Z")

</div>

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