# Displaying a string from the top row first column, possible?

**URL:** https://discuss.elastic.co/t/displaying-a-string-from-the-top-row-first-column-possible/377094
**Category:** Kibana
**Tags:** canvas
**Created:** [April 14, 2025, 7:03am UTC](https://discuss.elastic.co/t/displaying-a-string-from-the-top-row-first-column-possible/377094 "2025-04-14T07:03:20Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![JensHaglof](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@JensHaglof](https://discuss.elastic.co/u/JensHaglof)
#### Post date: [April 14, 2025, 7:03am UTC](https://discuss.elastic.co/t/displaying-a-string-from-the-top-row-first-column-possible/377094/1 "2025-04-14T07:03:20Z")

</div>

Imagine a table like this.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/3/3/33fbcccb8bfd6c181ad48e724efcb1af57d716e2.png)

I'm using the following query:

```auto
| selectFilter
| essql query="
    SELECT
    case
        when delivery_string like '%ups%' then 'UPS'
        when delivery_string like '%dhl%' then 'DHL'
        when delivery_string like '%schenker%' then 'SCHENKER'
        when delivery_string like '%early%' then 'EARLY BIRD'
        when delivery_string like '%best%' then 'BEST TRANSPORT'
        else 'UPS'
    end as freight_companies,
    case
        when delivery_string like '%ups%' then 1
        when delivery_string like '%dhl%' then 2
        when delivery_string like '%schenker%' then 3
        when delivery_string like '%early%' then 4
        when delivery_string like '%best%' then 5
        else 1
    end as order,
    sum(qty_ordered) as value
FROM 'outbound-orders'
WHERE 1 = 1
GROUP BY order
ORDER BY order DESC

```

What I want to do now is display the **top result** (i.e., the first freight company in the result set) in a separate box — using the **first value in the `freight_companies` column**.

If the table looks like this:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/3/3/33fbcccb8bfd6c181ad48e724efcb1af57d716e2.png)  
I want to display 'UPS' in the box.

If it looks like:  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/8/e8ff6ea58aca9eed16e080ceef8f6315b21b1176.png)  
I want to display 'DHL'.

Is that possible?

I've tried adding `LIMIT 1` and then:

```auto
| getCell column="freight_companies"
| render

```

But it didn't work.

/Jens

---

<div class="post-metadata">

### Author: ![jsanz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsanz/32/53734_2.png) [@jsanz](https://discuss.elastic.co/u/jsanz)
#### Post date: [April 14, 2025, 10:39am UTC](https://discuss.elastic.co/t/displaying-a-string-from-the-top-row-first-column-possible/377094/2 "2025-04-14T10:39:04Z")

</div>

If you want to render the first row of a query you can use the Markdown panel like this from the `kibana_sample_data_logs` sample dataset.

```auto
kibana
| selectFilter
| essql 
  query="
      SELECT machine.os as os, count(1) as count  
      FROM \"kibana_sample_data_logs\" 
      GROUP BY \"machine.os\" 
      ORDER BY count DESC
      LIMIT 1"
| markdown "{{#with rows.[0]}} Top OS is **{{os}}** with `{{count}}` rows{{/with}}"
| render

```

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/b/7/b7aa422869d632968a19e45cdc412061aaa77eae.png)

Or this markdown if you prefer a table

```markdown
{{#with rows.[0]}}
| OS | count |
| :--: | :--: |
| {{os}} | {{count}} |
{{/with}}

```

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/1/5154eda86cbbb4b4290547af8cec5692b0594a8e.png)

---

<div class="post-metadata">

### Author: ![JensHaglof](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@JensHaglof](https://discuss.elastic.co/u/JensHaglof)
#### Post date: [April 16, 2025, 11:28am UTC](https://discuss.elastic.co/t/displaying-a-string-from-the-top-row-first-column-possible/377094/3 "2025-04-16T11:28:31Z")

</div>

> [@jsanz](#):
>
> `"{{#with rows.[0]}} Top OS is **{{os}}** with `{{count}}` rows{{/with}}"`

Thank you! 😃 It worked. Now I got to learn that Markdown language!

---

<div class="post-metadata">

### Author: ![JensHaglof](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@JensHaglof](https://discuss.elastic.co/u/JensHaglof)
#### Post date: [May 6, 2025, 1:35pm UTC](https://discuss.elastic.co/t/displaying-a-string-from-the-top-row-first-column-possible/377094/4 "2025-05-06T13:35:36Z")

</div>

Hi!  
This is the result.  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/4/7/4766ea390dbf0b62b0892fae0f0aaca576604d0e.png)

Is it possible to change the color of the grey background tile? I would like to have a different color depending of the result.

Something like:

If order = 1 then bgcolor = '#e4f6d0'
