The following table describes these functions:
| Functions |
Details |
| Sum |
Format :
sum ( expr )
Description :
The Sum function adds all the values in the expression. Parameters :
Returns :
This returns the total value of the numeric expression ( expr ).
Example :
sum(
"Sales"."Price"
-
"Sales"."Discount"
) This calculated the selling price by subtracting the Discount from the Price and then finds the total selling price by adding values for all records. See Also:
|
| Avg |
Format :
avg ( expr )
Description :
The Avg function finds the average value of the expression's results. Parameters :
Returns :
This returns the average value of the numeric expression ( expr ).
Example :
avg(
"Sales"."Sales"
-
"Sales"."Cost"
) This calculated the profit by subtracting the Cost from the Sales for all records and then finds the average of these values. See Also:
|
| Min |
Format :
min ( expr )
Description :
The Min function finds the minimum value of the expression's results. Parameters :
Returns :
This returns the minimum value of the expression ( expr ). Example : min( "Sales"."Amount" ) This will find the minimum sales done. Note:
See Also:
|
| Max |
Format :
max ( expr )
Description :
The Max function finds the maximum value of the expression's results. Parameters :
Returns :
This returns the maximum value of the expression ( expr ). Example : max( "Sales"."Amount" ) This will find the maximum sales done. Note:
See Also:
|
| Count |
Format :
count ( expr )
Description :
The Count function identifies the number of rows where the expression's result is present. Parameters :
Returns :
This returns the count of rows with the expression's result. Example : count( "Sales"."Customer_ID" ) This will find the total number of rows with a Customer_ID. Note:
See Also:
|
| Distinct Count |
Format :
distinctcount ( expr )
Description :
The Distinct Count function identifies the number of unique values present in the expression's result. Parameters :
Returns :
This returns the count of unique values in the expression's result. Example : count( "Sales"."Customer_ID" ) This will find the total number of customers present in the data. Note:
See Also:
|
| Count_WB |
Format :
count_wb ( expr )
Description :
The Count_WB function identifies the number of rows where the expression's result is present including the null value. Parameters :
Returns : This returns the count of rows with the expression's result including the null value. Example : count( "Feedback"."email_id" ) This will find the total number of feedback entries with or without the email address. See Also:
|
| Stddev |
Format :
stddev ( expr )
Description :
The stddev is a statistical number that measures how spread out the values are. Parameters :
Returns :
This returns the standard deviation of the numeric expression ( expr ).
Example :
stddev
(
"Stock"."Price
"
) This returns the standard deviation of the stock price. This helps in measuring the risk involved in the investment. See Also: stddev_samp(), variance() , var_samp() |
| Variance |
Format :
variance ( expr )
Description :
The Variance is another statistical number that measures how spread out the values are. Parameters :
Returns :
This returns the standard deviation of the numeric expression ( expr ).
Example :
stddev
(
"Stock"."Price
"
) This returns the variance of the stock price. This helps in measuring the risk involved in the investment. See Also: stddev_samp(), stddev() , var_samp() |
| SumIf |
Format:
sumif ( condition , expr1 or expr2 )
Description :
The SumIf calculates the sum of the expr1 or expr2 based on the condition specified. The expr1 or expr2 can be an expression or just a numeric column. Parameters:
Returns:
This returns the sum of expr1 , if the condition is true. Else it will return the sum of expr2 .
Example:
sumif ( "Sales"."Status"
!=
'
Cancelled'
,
"Sales"."Amount"
,
0 ) This will return the sum of the Amount if the status is not cancelled. Else it will return zero. Note:
In case the expr2 is not provided, it will be taken as null value.
See Also:
|
| AvgIf |
Format:
avgif ( condition , expr1 or expr2 )
Description :
The AvgIf calculates the average of the expr1 or expr2 based on the condition specified. The expr1 or expr2 can be an expression or just a numeric column. Parameters:
Returns:
This returns the average of expr1 if the condition is true. Else it will return the average of expr2 .
Example:
avgif ( "Deals
"."Stage"
=
'Closed Lost to Competition'
,
"Sales"."Amount" ) This will return the average deal Amount that is lost to Competition. Note:
In case the expr2 is not provided, it will be taken as null value.
See Also:
|
| CountIf |
Format:
countif ( condition , expr1 or expr2 )
Description :
The CountIf calculates the count of the expr1 or expr2 based on the condition specified. The expr1 or expr2 can be an expression or just a numeric column. Parameters:
Returns:
This returns the count of expr1 , if the condition is true. Else it will return the count of expr2 .
Example:
countif ( "Tasks"."Status" = ' Overdue ') This will return the number of task where the status is overdue. Note:
In case the expr2 is not provided, it will be taken as null value.
See Also:
|
| YTD |
Format:
ytd ( aggexpr , date_column, fiscal_start_Month [Optional])
Description :
The Year-to-Date filters the period, starting from the beginning of every year and ends at the current date of the respective year. Parameters:
Returns:
This returns the result of the aggexpr for the filtered period.
Example:
ytd ( sum ( "Sales"."Sales" ), "Sales"."Date" ) Let's assume that the current date is 17th March 2019. This formula will return the sum of sales for all years till 17th March of that year. See Also:
|
| QTD |
Format:
qtd ( aggexpr , date_column, fiscal_start_Month [Optional])
Description :
The Quarter-to-Date filters the period, starting from the beginning of every quarter and ends at the same quarter's n th day n th month of current date. Parameters:
Returns:
This returns the result of the aggexpr for the filtered period.
Example:
qtd ( sum ( "Sales"."Sales" ), "Sales"."Date" ) Let's assume that the current date is 17th March 2019 and you have the calendar year as your fiscal year. This formula will return the sum of sales for all quarters till 17th of the last month of the quarter. See Also:
|
| MTD |
Format:
mtd ( aggexpr , date_column, fiscal_start_Month [Optional])
Description :
The Month-to-Date filters the period, starting from the beginning of every month and ends at the current date of that month. Parameters:
Returns:
This returns the result of the aggexpr for the filtered period. Example: mtd ( sum ( "Sales"."Sales" ), "Sales"."Date" ) Let's assume that the current date is 17th March 2019. This will return the sum of sales for the all months till the 17th of that month. See Also:
|
| Mean |
Format :
mean ( expr )
Description :
The Mean is the average calculated by adding all numbers in the data set and then dividing by the number of rows. Parameters :
Returns :
This returns the average value of the numeric expression ( expr ).
Example :
mean(
"Deals"."Amount"
) This returns the average deal amount by adding all deal amount and divide it by the number of deals. See Also:
|
| Median |
Format :
median ( expr )
Description :
The Median is the average calculated by ordering the values from least to greatest and identify the middle value of the data. Parameters :
Returns :
This orders the result of the numeric expression ( expr) in ascending order and returned the middle value.
Example :
median(
"Deals"."Amount
"
) This will order the deal amount from least to greatest and return the middle value. See Also:
|
| Mode |
Format :
mode ( expr )
Description :
The Mode is the most frequently occurring value. Parameters :
Returns :
This returns the value that occurs most often in the expression's result.
Example :
mode(
"Tickets"."Number of Responses
"
) This will return the Number of Responses taken to close most of the tickets. See Also:
|
| Percentile |
Format :
percentile ( expr, range )
Description :
The Percentile identifies a value where a certain percentage of value falls below that number. Parameters :
Returns :
This returns a value below which the specified percentage of the expression ( expr ) value lies.
Example :
percentile
(
"Sales"."Amount
",
90
) This will identify a sales value below which 90% of the sales amount lies. |
By default, Aggregate Formula values will be computed for each data record/group in a report in which it is used. However, to meet your specific requirements, you can also specify how a column's data is to be grouped for computing the values.
The Groupby Shifting Expressions give you more control over how the columns are grouped to compute the values. Zoho Analytics allows you to perform this in the following levels.
The Include Groupby formula allows you to add more dimensions to a group by clause, along with the existing dimensions used, in the report where this Aggregate Formula is used.
Format
Example
In the above expression, we calculate the average of Sales per Customer . The Sum of Sales is first grouped by Customer Name , along with the existing group by columns in the report. This will get the total sales for each customer. Now the average of these values will be displayed in the report i.e., the average of Sales per Customer.
In the above chart, the Avg Sales column shows the total sales average for Product Category in each Region. The aggregate formula Avg Sales per Customer shows the average sales made by a customer.
Exclude Groupby allows you to omit or ignore group by dimensions, that are available in the report when aggregate values are computed.
Format
Example
In the above chart, the Regional Sales column shows the total sales in each Region for Product Category . And the aggregate formula shows the total sales in the Product Category ignoring the Region field in the report.
Format
Example
Here, irrespective of whatever grouping is done in the report, data will be grouped by the absolute quarter of the Date column to compute the sum of Sales. i.e., irrespective of the Regional grouping in the report, the formula will calculate the quarterly sales.
In the above chart, the Total Sales shows the sales for the dimension in the chart. The aggregate formula Quarterly Sales shows the sales in each quarter irrespective of the dimension used in the report.
This Map Groupby maps a group by column with another. When you use the first group by column in the report, the aggregate expression will be calculated based on the mapped column instead of the column in the report.
Format
In the above expression, when you add Order Date as a dimension in your report, the sum of delivered sales will be calculated based on the Delivery Date instead of Order Date .
The Tabular Function enables you to perform an aggregate calculation across a set of rows that are related to the current row. Unlike in aggregate functions where the query groups the result into a single output row, a tabular function accesses more than just the current row of the query result, allowing you to perform advanced operations.
The following table describes the Tabular functions:
Zoho Analytics allows you to change the partition or sorting order to apply the calculation in the report as needed. Click the Aggregate Formula dropped in the report, the Show Data Setting:{Column Name} dialog will open. The result will be computed based on the setting here.
The Calculate By field allows you to specify the column based on which the calculation needs to be calculated.
For example, the following report shows the running total of sales by region across the months.
By default, the running sales will be calculated for all the rows in the report. Hence in the above chart, the running sum of the Central will be added to the East values. To calculate the running total for each region across the months, follow the below steps.
Using the Sort By option, you can choose to sort the rows in the report based on any column in the table over which the report is created. The calculation will be performed based on this order.
For example, in the below chart, the running total is sorted based on another metric in the table i.e., sum of sales.