# Canvas and Dashboard show different values

**URL:** <https://discuss.elastic.co/t/canvas-and-dashboard-show-different-values/288418>\
**Category:** Kibana\
**Tags:** canvas\
**Created:** [November 4, 2021, 2:20pm UTC](https://discuss.elastic.co/t/canvas-and-dashboard-show-different-values/288418 "2021-11-04T14:20:31Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![r.pollak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/r.pollak/32/96284_2.png) [@r.pollak](https://discuss.elastic.co/u/r.pollak)\
**Post date:** [November 4, 2021, 2:20pm UTC](https://discuss.elastic.co/t/canvas-and-dashboard-show-different-values/288418/1 "2021-11-04T14:20:31Z")

</div>

Hi together,  
I have created a metric visualization on a dashboard. The metric just counts the number of records (1.436) see picture below.

 ![2021-11-04 15_17_03-](https://us1.discourse-cdn.com/elastic/original/3X/7/5/75b00f05c43a9b3c67e578b94667d1aa21dbb893.jpeg)

I have created a metric visualization on a canvas (some index) and the metric shows a value of 1.000?

 ![2021-11-04 15_07_14-](https://us1.discourse-cdn.com/elastic/original/3X/d/8/d84e33f3c742d03c4ed9da3a0b13c187cbea74b2.jpeg)

 ![2021-11-04 15_07_25-](https://us1.discourse-cdn.com/elastic/original/3X/9/d/9d94f1573688343fc6c55ab1ff9e275754ac9ce6.jpeg)

Can you please point me in the right direction?  
Thanks in adbanced for your support.  
Regards,  
Rainer

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [November 4, 2021, 3:23pm UTC](https://discuss.elastic.co/t/canvas-and-dashboard-show-different-values/288418/2 "2021-11-04T15:23:48Z")

</div>

Can you share the expression behind the metric in canvas? Also, could you make sure the time range is the same in visualize by clicking the "Inspect" button in the top right and switch to request?

---

<div class="post-metadata">

**Author:** ![r.pollak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/r.pollak/32/96284_2.png) [@r.pollak](https://discuss.elastic.co/u/r.pollak)\
**Post date:** [November 4, 2021, 3:40pm UTC](https://discuss.elastic.co/t/canvas-and-dashboard-show-different-values/288418/3 "2021-11-04T15:40:35Z")

</div>

Hi Joe,  
here comes the expression behind the metric in canvas:

```auto
filters
| essql query="SELECT * FROM \"smartperform_statistics*\""
| math "size(@timestamp)"
| metric "Interactions" 
  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

```

Here comes the inspect-\>request info from the dashboard\_

```auto
{
  "aggs": {},
  "size": 0,
  "fields": [
    {
      "field": "@timestamp",
      "format": "date_time"
    }
  ],
  "script_fields": {},
  "stored_fields": [
    "*"
  ],
  "runtime_mappings": {},
  "_source": {
    "excludes": []
  },
  "query": {
    "bool": {
      "must": [],
      "filter": [
        {
          "match_phrase": {
            "fields.ComputerName.keyword": "I7L018"
          }
        },
        {
          "range": {
            "@timestamp": {
              "format": "strict_date_optional_time",
              "gte": "2021-11-03T23:00:00.000Z",
              "lte": "2021-11-04T22:59:59.999Z"
            }
          }
        }
      ],
      "should": [],
      "must_not": []
    }
  }
}

```

And here the debug filter from the canvas  
 ![grafik](https://us1.discourse-cdn.com/elastic/original/3X/5/6/569d956da78a04461c099cf8b1f9ff7f691d5921.png)

Thanks for your support.  
Rainer

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [November 4, 2021, 5:00pm UTC](https://discuss.elastic.co/t/canvas-and-dashboard-show-different-values/288418/4 "2021-11-04T17:00:13Z")

</div>

I think a `SELECT` query won't give you the full data because of the cost - it has to transfer all documents into the browser. Doing `essql query="SELECT COUNT(*) as count FROM \"smartperform_statistics*\""` instead of `size` in the math moves this into Elasticsearch and makes sure it's executed on the full data. The math can be replaced by a `getCell`.

---

<div class="post-metadata">

**Author:** ![r.pollak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/r.pollak/32/96284_2.png) [@r.pollak](https://discuss.elastic.co/u/r.pollak)\
**Post date:** [November 4, 2021, 5:15pm UTC](https://discuss.elastic.co/t/canvas-and-dashboard-show-different-values/288418/5 "2021-11-04T17:15:13Z")

</div>

Hi Joe,  
I have not created this query. I have just used the menu from the selected element.  
Question: Can I simply replace the query inside the Expression editor? And / or how can I save this query?

---

<div class="post-metadata">

**Author:** ![r.pollak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/r.pollak/32/96284_2.png) [@r.pollak](https://discuss.elastic.co/u/r.pollak)\
**Post date:** [November 4, 2021, 5:18pm UTC](https://discuss.elastic.co/t/canvas-and-dashboard-show-different-values/288418/6 "2021-11-04T17:18:12Z")

</div>

Excellent this query works!  
Thanks a lot for your help!

---

<div class="post-metadata">

**Author:** ![r.pollak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/r.pollak/32/96284_2.png) [@r.pollak](https://discuss.elastic.co/u/r.pollak)\
**Post date:** [November 5, 2021, 1:50pm UTC](https://discuss.elastic.co/t/canvas-and-dashboard-show-different-values/288418/7 "2021-11-05T13:50:26Z")

</div>

Hi Joe,

following your advice, I have tried another visual and created the following SELECT query to perform the work on the server:

SELECT COUNT(fields.Event) FROM "smartperform\_statistics\*"

WHERE "fields.Event" = View.End

I get the error message

Expression failed with the message:

[essql] \> Couldn't parse Elasticsearch SQL query. You may need to add double quotes to names containing special characters. Check your query and try again. Error: line 2:29: no viable alternative at input 'View.End'

I cannot find a hint inside the documentation. All examples I have found so far, are looking quit similar to me.

Sorry to ask for your support again.

Regards,

Rainer

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [November 5, 2021, 2:22pm UTC](https://discuss.elastic.co/t/canvas-and-dashboard-show-different-values/288418/8 "2021-11-05T14:22:37Z")

</div>

You need to put the quotes around the value, not the field name

```auto
WHERE fields.Event = "View.End"

```

---

<div class="post-metadata">

**Author:** ![r.pollak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/r.pollak/32/96284_2.png) [@r.pollak](https://discuss.elastic.co/u/r.pollak)\
**Post date:** [November 5, 2021, 2:38pm UTC](https://discuss.elastic.co/t/canvas-and-dashboard-show-different-values/288418/9 "2021-11-05T14:38:24Z")

</div>

Hi Joe,

for some reason, the query works only with “ ‘ “.

---

<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 3, 2021, 2:38pm UTC](https://discuss.elastic.co/t/canvas-and-dashboard-show-different-values/288418/10 "2021-12-03T14:38:43Z")

</div>

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