> For the complete documentation index, see [llms.txt](https://docs.agilecase.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.agilecase.com/administrator-documentation/reports/creating-reports/using-the-count-function-in-a-report.md).

# Using the Count Function in a Report

This lesson will show you how to use the count function in a report. The count function allows a report to count the number of instances of a particular entity. In this case, we will use a simple count to display the number of customers the client has from each company they work with.

### Adding a count function

<figure><img src="/files/DH0TVeeTdln4CjwS8Iw7" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/GfkPYcqQOJmGcduSY34P" alt="" width="140"><figcaption></figcaption></figure>

To add a count function, first add the entity that you want to count the instances of to the table as a column. As we want to count the number of customers, we shall use the field "Customer Name". When you hover the mouse over the column you want to turn into a count, you will notice a small "f" icon on the right hand side of the screen.

Clicking this will open a dropdown menu from which you can select "Count". This will turn the column into a count column.

### Name the count

<figure><img src="/files/GB9IPnjct9m54L3wH6mm" alt=""><figcaption></figcaption></figure>

As you can see, the column name is now prefixed with "Count of". It will probably be appropriate to change the title of the new count column, which you can do as you would with a regular column. Once this is complete, you can preview or run the report to view the count function in action.

### Count function in a report

<figure><img src="/files/PrtiF3jOle9sq6s2O4qp" alt=""><figcaption></figcaption></figure>

As you can see here, instead of displaying a row for each customer from each company, the report now shows a row for each company with the number of customers displayed in the count column that has just been created.

### Troubleshooting

{% hint style="warning" %}
When creating a count, it is important to remember that the order of columns in the report affects the output of the count function. This can lead to the count not functioning properly in complex reports or reports that include multiple counts.
{% endhint %}

If you are having problems getting a count function to work, please contact us on <support@agilecase.com>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.agilecase.com/administrator-documentation/reports/creating-reports/using-the-count-function-in-a-report.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
