How to customize output with groupby and aggregate fields in merge

How to customize output with groupby and aggregate fields in merge

Overview

In Zoho Writer, when working with merge templates, you can use transformaggregate functions and grouping to summarize and organize your data—especially useful when dealing with tabular data like invoices, reports, or summaries.

With Groupby and Aggregate Field you can organize and compute data as shown


✴️ Transform Merge Data

You can transform data during a merge to display it in the desired format or structure—without modifying the original source. When your data source (like Zoho CRM or Zoho Creator) provides flat or repeated records—and you want to display them in a nested, grouped format (like a subform or table)—you can transform the data during the merge using Zoho Writer's Data Transformation options.

✅ Group By

Group By merge fields are used to group and display repeated records in a structured way, organizes the data into sections based on unique values of that field. 
Example use case: Group sales data by Region, so that all sales entries under each region are listed together.

✴️ Aggregate Functions

Once grouped, you can apply aggregate functions like:
SUM() – Total values (e.g., total sales)
MAX() – Highest value
MIN() – Lowest value
AVG() – Average value

Prerequisites

  1. Open a new merge template in Zoho Writer (File --> New Automation Template --> Merge Template --> Create from scratch)
  2. Go to Automate > Setup Data Source and Fields in the template

Steps

  1. To Transform data

    1. Click on Transform Data Source as shown below 
    2. Under Manage Fields and click on Transform to create subform.
                                                                         

                                                

     c. Grouping by a column results in a grouped subform creation.

To edit or clear transformation

  1. Click on the transform icon and choose Edit Transformed Data Source or Clear Transformed & Revert.
    Note: Clearing the transformed field reverts it to a main field and the inserted transformed fields will now be unmapped.
  2.                                                       

To Create GroupSets:

  1. You can group data from field listing using the GroupBy icon as shown below
                                                                   

or using the Group by icon after inserting the data as a repeat block in the template as shown
In the Group by popup , Set the Name of the Group by Field and the Fields to be grouped
                                                

To create aggregate fields

   Click on Aggregate icon to Aggregate Data of the select fields for a given Group Set or Whole Data as shown in the popup 

                                           
    

1. Watch : GroupBy and Aggregate Functions in Zoho Writer
2.  Learn More about Groupby and data aggregation in Zoho Writer