> For the complete documentation index, see [llms.txt](https://docs.cloudfabrix.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cloudfabrix.io/rda/rda-userguide/rda-data-management-cfxdm/cfxdm-dm-groupby.md).

# cfxdm - dm:groupby

**dm:groupby:** This cfxdm tag allows the user to group the data (by rows) based on selected columns using aggregate functions.

**dm:groupby** synta&#x78;**:**&#x20;

* **columns** (mandatory)**:** Select one or more columns for grouping the data.
* **agg** (optional)**:**
  * **count:** It is applied by default when 'agg' is not specified. Supported on any value types (numeric or non-numeric values)
  * **min:** Supported on numeric values only
  * **max:** Supported on numeric values only
  * **sum:** Supported on numeric values only

In the below example, for a reference, we are going to use **VMware vCenter** as an extension to query the data from VMs tag and their disk size.

Enter the below command to select **VMware vCenter VMs tag (\*vcenter:vms**). (In this example, **vcenter** name is used as a label to identify VMware vCenter extension and it's tags. The label is defined while adding the extension in cfxdx configuration file or through UI)

```
tag *vcenter:vms
```

![](/files/-MW6us2YRudI68Vogt0D)

**Example-1:**&#x20;

Get the VM's list from the above tag and select the below columns  (as shown)

* vm\_name
* disk\_capacity\_kb
* bios\_uuid

```
data * get name as 'vm_name',disk_capacity_KB as 'disk_capacity_kb',id as 'bios_uuid'
```

Pipe the data to **dm:groupby** tag to view the data grouped by VM Name.

{% hint style="info" %}
Since '**agg**' option is not specified within the **dm:groupby** tag, it applies agg function '**count**' by default.
{% endhint %}

```
data * get name as 'vm_name',disk_capacity_KB as 'disk_capacity_kb',id as 'bios_uuid' --> dm:groupby columns = 'vm_name'
```

![](/files/-MW7BrfFCYO5_59TAriy)

**Example-2:**&#x20;

Continuing with above data, lets use agg function '**sum**' to calculate total VM's disk size.&#x20;

{% hint style="info" %}
When agg function '**sum**' is used, it automatically applies on all eligible columns (numerical values).&#x20;
{% endhint %}

```
data * get name as 'vm_name',disk_capacity_KB as 'disk_capacity_kb',id as 'bios_uuid' --> dm:groupby columns = 'vm_name' & agg = 'sum'
```

![](/files/-MW7E2ELU-mkLfZt_jnL)
