# Count() function on link to table field returns an array of 1s

**URL:** https://community.baserow.io/t/count-function-on-link-to-table-field-returns-an-array-of-1s/12368
**Category:** Technical Help
**Tags:** grid, formula
**Created:** [April 28, 2026, 9:10am UTC](https://community.baserow.io/t/count-function-on-link-to-table-field-returns-an-array-of-1s/12368 "2026-04-28T09:10:54Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Yam](https://community.baserow.io/letter_avatar_proxy/v4/letter/y/c57346/32.png) [@Yam](https://community.baserow.io/u/Yam)
#### Post date: [April 28, 2026, 9:10am UTC](https://community.baserow.io/t/count-function-on-link-to-table-field-returns-an-array-of-1s/12368/1 "2026-04-28T09:10:54Z")

</div>

### Are you using our SaaS platform ([Baserow.io](http://Baserow.io)) or self-hosting Baserow?

SaaS

### What are the exact steps to reproduce this issue?

In a table (=`Events`), I have a link-to-table field (=`Instances`).  
In another column, I have the following formula: `count(field('Instances'))`

The returned value looks like the first attached screenshot.

The expected value looks like the second screenshot (I worked around the current behavior by changing it to `sum(count(field('Instances')))`).

It seems that it’s applying `count` as an array formula on each individual item in the link-to-table field…

Note: I believe that this is a regression as this formula used to work some time ago (not sure which version changed the behavior)

### Attach screenshots, videos, or logs that demonstrate the issue.

 ![Screenshot 2026-04-28 180333.png](https://community.baserow.io/uploads/default/original/2X/b/be16893895eb80f5f51b78bc2b4dcb1cdeb04e5c.png) ![Screenshot 2026-04-28 181008.png](https://community.baserow.io/uploads/default/original/2X/d/daf21de3959a8b5fa5c88f3bb832139dff825679.png)

---

<div class="post-metadata">

### Author: ![olgatrykush](https://community.baserow.io/user_avatar/community.baserow.io/olgatrykush/32/219_2.png) [@olgatrykush](https://community.baserow.io/u/olgatrykush)
#### Post date: [April 28, 2026, 2:02pm UTC](https://community.baserow.io/t/count-function-on-link-to-table-field-returns-an-array-of-1s/12368/2 "2026-04-28T14:02:58Z")

</div>

Hi @Yam 👋

Thanks for reporting this! We’re investigating and had a quick follow-up question that might help pinpoint the issue.

In your linked table (“Instances”), is the primary field a lookup field or a formula that returns an array? And if so, have you changed that field recently?

This could affect how `count(field('Instances'))` behaves.

Thanks!

---

<div class="post-metadata">

### Author: ![Yam](https://community.baserow.io/letter_avatar_proxy/v4/letter/y/c57346/32.png) [@Yam](https://community.baserow.io/u/Yam)
#### Post date: [April 28, 2026, 3:31pm UTC](https://community.baserow.io/t/count-function-on-link-to-table-field-returns-an-array-of-1s/12368/3 "2026-04-28T15:31:15Z")

</div>

The primary field in `Instances` is field `Instance`, a formula that concatenates the instance’s date and the instance’s event. I thought that they were joined into a string but it’s possible that I missed that and it’s indeed returning an array. This would explain the behaviour.

However I have another problem. It seems that I cannot see the primary field `Instance` in the `Instances` grid view any more. Instead the `Event` column is the leftmost column:

![image](https://community.baserow.io/uploads/default/optimized/2X/6/628ca7b84f714fdd1dcf2691a7f66c06e302de6a_2_690x19.png)

When I enlarge a row, the `Instance` column is also not showing.

But when I go the `Events` table and look at the `Instances` column, it contains the output of the formula that I had created, and drilling down into the details shows the column:

 ![Screenshot 2026-04-29 000944](https://community.baserow.io/uploads/default/original/2X/5/551f9e48dea67a61a1b9c30d57a9b21a54c5ec6e.jpeg)

 ![Screenshot 2026-04-29 001202](https://community.baserow.io/uploads/default/original/2X/2/25d7b36854db5f83e7d3b93860c5036d7f15f2a7.jpeg)

So long story short:

In the `Instances` table, the `Instance` column is not accessible anymore, and it looks like the `Event` column replaced it as the primary field.

But in the `Events` table, it looks as I remember setting it up.

I am confused as to what I am missing here.

---

<div class="post-metadata">

### Author: ![Yam](https://community.baserow.io/letter_avatar_proxy/v4/letter/y/c57346/32.png) [@Yam](https://community.baserow.io/u/Yam)
#### Post date: [April 28, 2026, 3:43pm UTC](https://community.baserow.io/t/count-function-on-link-to-table-field-returns-an-array-of-1s/12368/4 "2026-04-28T15:43:23Z")

</div>

Quick addendum: if I try to create a new column `Instance` in the `Instances` table, baserow protests that the column already exists.

But I can’t find a way to get it displayed in the grid view in its expected position (leftmost column / primary field).

EDIT 2: If I create a new grid view from scratch, the primary field `Instance` appears as expected:

![image](https://community.baserow.io/uploads/default/original/2X/4/4a5fbb0f198bd73448a4c4e21a649a479ed0491c.png)

But for some reason, all my previously created grids look like this:

![image](https://community.baserow.io/uploads/default/original/2X/b/b5739906323b4470176a2bc0333066900074e8dd.png)

with `Event` being the sticky leftmost column.

I am still not sure how to “unhide” the primary field here.

* * *

Also, after creating the new grid and getting access to the primary field again, I can confirm that the formula did not return a string but an array as you suspected. Modifying it to return a string addressed the original issue for this topic. Thank you!

---

<div class="post-metadata">

### Author: ![olgatrykush](https://community.baserow.io/user_avatar/community.baserow.io/olgatrykush/32/219_2.png) [@olgatrykush](https://community.baserow.io/u/olgatrykush)
#### Post date: [April 29, 2026, 10:59am UTC](https://community.baserow.io/t/count-function-on-link-to-table-field-returns-an-array-of-1s/12368/5 "2026-04-29T10:59:45Z")

</div>

Hey @Yam, glad to hear the first issue is resolved now. Regarding the visibility of the primary field, could this be the same UI issue discussed here: [Primary fields gone missing - #4 by davide](https://community.baserow.io/t/primary-fields-gone-missing/12348/4)

---

<div class="post-metadata">

### Author: ![Yam](https://community.baserow.io/letter_avatar_proxy/v4/letter/y/c57346/32.png) [@Yam](https://community.baserow.io/u/Yam)
#### Post date: [April 29, 2026, 2:45pm UTC](https://community.baserow.io/t/count-function-on-link-to-table-field-returns-an-array-of-1s/12368/6 "2026-04-29T14:45:43Z")

</div>

It looks similar if not identical to the issue that you linked to indeed. I’ll follow the discussion there.

---

<div class="post-metadata">

### Author: ![olgatrykush](https://community.baserow.io/user_avatar/community.baserow.io/olgatrykush/32/219_2.png) [@olgatrykush](https://community.baserow.io/u/olgatrykush)
#### Post date: [April 29, 2026, 4:04pm UTC](https://community.baserow.io/t/count-function-on-link-to-table-field-returns-an-array-of-1s/12368/7 "2026-04-29T16:04:15Z")

</div>

Agreed! We’ve also created an issue for the `count` function, as it should always return a number: [count() returns an array instead of a number in some cases · Issue #5276 · baserow/baserow · GitHub](https://github.com/baserow/baserow/issues/5276)

---

<div class="post-metadata">

### Author: ![Yam](https://community.baserow.io/letter_avatar_proxy/v4/letter/y/c57346/32.png) [@Yam](https://community.baserow.io/u/Yam)
#### Post date: [April 29, 2026, 4:53pm UTC](https://community.baserow.io/t/count-function-on-link-to-table-field-returns-an-array-of-1s/12368/8 "2026-04-29T16:53:49Z")

</div>

To be honest, now that I understand why `count()` behaved like it did in my example, I think it makes sense (if you count an array of arrays, you get an array of the array counts). Using `sum()` can be used to get a total if needed. Changing the behavior could make it difficult for other cases. Like if you have an array of arrays and you want the max of counts of the element arrays; if count is made to work recursively until the result is a number, it becomes impossible.

---

<div class="post-metadata">

### Author: ![davide](https://community.baserow.io/user_avatar/community.baserow.io/davide/32/2425_2.png) [@davide](https://community.baserow.io/u/davide)
#### Post date: [April 30, 2026, 11:32am UTC](https://community.baserow.io/t/count-function-on-link-to-table-field-returns-an-array-of-1s/12368/9 "2026-04-30T11:32:59Z")

</div>

That’s a fair point, but `count()` is fundamentally an aggregation function, so it should always return a number.

Your example of getting the max of element array counts is valid, but it can also be achieved with a dedicated count field on the related table combined with `max(lookup(link, count_field))`.

It’s a bit more verbose, but more explicit and predictable. Allowing `count()` to sometimes return an array also risks breaking other formula field interactions down the line, when the source field change from an array to something else.
