---
title: "The Count function to aggregate data"
slug: "the-count-function"
updated: 2026-01-27T08:16:59Z
published: 2026-01-27T08:16:59Z
canonical: "userguide.dataclassroom.com/the-count-function"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://userguide.dataclassroom.com/llms.txt
> Use this file to discover all available pages before exploring further.

# The Count function to aggregate data

Sometimes you may want to aggregate your data and have the tool **count how many rows** have a given value of a categorical variable.

Or you might want to **count combinations** of two or more categorical variables. The **Count** function is found under **Advanced** in the left-hand menu:

![](https://cdn.document360.io/62f8f41e-e041-42c4-b9bc-8ae1eb45d064/Images/Documentation/image-1757140004791.png)

It will ask you which categorical columns you want to count the values from and what to call the column with the resulting **Sample Count** data.

For example in the dataset below ([on DataClassroom here](https://dataclassroom.com/en/dataseteditor/4c9ec87b-e9da-4723-87c3-c1f89f67dc36)), a set of observations of species A, B and C have been recorded for two different days, in [Tidy format](/v1/docs/converting-data-to-tidy-format) i.e. one observation per row:

![](https://cdn.document360.io/62f8f41e-e041-42c4-b9bc-8ae1eb45d064/Images/Documentation/image-1757140220681.png)

Using the Count function can get you a summary of the numbers of observations. Counting the combinations of Day and Species would result in something like this:

![](https://cdn.document360.io/62f8f41e-e041-42c4-b9bc-8ae1eb45d064/Images/Documentation/image-1757140311962.png)

**NOTE**The new column with the counts is automatically set to the [correct type](/v1/docs/data-types): **Sample count** as in our [example dataset](https://dataclassroom.com/en/dataseteditor/58bb46ca-ecc0-4cc0-8122-07046990ae40).
