# Can a Kibana Canvas Markdown Element Display a Total of a Column?

**URL:** <https://discuss.elastic.co/t/can-a-kibana-canvas-markdown-element-display-a-total-of-a-column/245797>\
**Category:** Kibana\
**Tags:** canvas\
**Created:** [August 20, 2020, 4:49pm UTC](https://discuss.elastic.co/t/can-a-kibana-canvas-markdown-element-display-a-total-of-a-column/245797 "2020-08-20T16:49:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![devbot](https://avatars.discourse-cdn.com/v4/letter/d/9de0a6/32.png) [@devbot](https://discuss.elastic.co/u/devbot)\
**Post date:** [August 20, 2020, 4:49pm UTC](https://discuss.elastic.co/t/can-a-kibana-canvas-markdown-element-display-a-total-of-a-column/245797/1 "2020-08-20T16:49:25Z")

</div>

I have a Markdown Element on a Kibana canvas with the Expression Syntax:

```auto
    filters group="default"
    | essql 
      query="SELECT host.hostname, (last(system.memory.actual.used.bytes, \"@timestamp\")/1073741824 as memoryused, last(system.memory.total, \"@timestamp\")/1073741824 as memory from \"metricbeat*\" where system.memory.actual.used.bytes is not null group by host.hostname"
    | head 1
    | mapColumn "memoryused" expression={getCell "memoryused" | math expression="value" | formatNumber "0,0"}
    | mapColumn "memory" expression={getCell "memory" | math expression="value" | formatNumber "0,0"}
    | markdown "
    {{#each rows}}
     **{{memoryused}}** of **{{memory}}** GB
    {{/each}}" 
      font={font family="Roboto, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'" size=16 align="center" color="#000000" weight="normal" underline=false italic=false}
    | render containerStyle={containerStyle}

```

The essql query used here returns:

**host.hostname** | **memoryused** | **memory**

ip1 | 2 | 10

ip2 | 10 | 100

ip3 | 20 | 100

The markdown element as it is currently will display whatever the first row of the result is, so usually:

"2 of 10 GB"

What can I change **in this markdown element** about the expression syntax, or query, to get the **total** of these 2 columns and have the end result display:

"32 of 210 GB"

---

<div class="post-metadata">

**Author:** ![corey.robertson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/corey.robertson/32/54611_2.png) [@corey.robertson](https://discuss.elastic.co/u/corey.robertson)\
**Post date:** [August 20, 2020, 8:27pm UTC](https://discuss.elastic.co/t/can-a-kibana-canvas-markdown-element-display-a-total-of-a-column/245797/3 "2020-08-20T20:27:13Z")

</div>

You can use `staticColumn` to add a new column to hold the sum values and then access that in your markdown.

Something like

```auto
essql "...."
| staticColumn name="totalUsed" value={math "sum(memoryused)"}
| markdown content="{{rows.[0].totalUsed}}"
```

---

<div class="post-metadata">

**Author:** ![devbot](https://avatars.discourse-cdn.com/v4/letter/d/9de0a6/32.png) [@devbot](https://discuss.elastic.co/u/devbot)\
**Post date:** [August 20, 2020, 8:35pm UTC](https://discuss.elastic.co/t/can-a-kibana-canvas-markdown-element-display-a-total-of-a-column/245797/4 "2020-08-20T20:35:01Z")

</div>

This worked. Exactly what I needed, thank you so much!

I also found that I needed to remove "| head 1 " from the expression syntax for this as well.

---

<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:35pm UTC](https://discuss.elastic.co/t/can-a-kibana-canvas-markdown-element-display-a-total-of-a-column/245797/5 "2020-09-17T20:35:19Z")

</div>

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