Supported Functions
Zoho Analytics provides you with a variety of inbuilt functions which are predefined mathematical formulas designed to perform specific well-known calculations easily. This section lists the supported inbuilt functions.
- Date functions
- Duration functions
- Numeric functions
- String functions
- Logical functions
- Geo Spatial Functions
- General functions
Formula Column In-built functions
The following table gives a list of inbuilt functions provided by Zoho Analytics, which can be used to create any formula. The inbuilt formulas are categorized/grouped based on the type of function.
Date Functions
| FUNCTION | DESCRIPTION | EXAMPLE |
| Absolute Month - absmonth(date_column) | This function will return month and year from a given date value with the format (Month, yyyy). | absmonth('2011/8/7') = August, 2011 |
| Absolute Quarter - absquarter(date_column) | This function will return Quarter and year from a given date value with the format (Quarter, yyyy). | absquarter('2011/8/7') = Q3, 2011 |
| Absolute Week - absweek(date_column) | This function will return week and year from a given date value with the format (Week, yyyy). | absweek('06/04/2011') = W14, 2011 |
| Add Date - adddate(date_column, num_of_days) | This function will add the specified number of days(num_of_days) to the given date value. | adddate('2011/8/7',10) = 2011/8/1 |
| Add Week addweek(date_column, num_of_weeks) | This function will add the specified number of weeks(num_of_weeks) to the given date value. | addweek('2013-08-27',10) = 2013-11-05 |
| Add Month addmonth(date_column, num_of_months) | This function will add the specified number of months(num_of_months) to the given date value. | addmonth('2013-08-27',10) = 2014-06-27 |
| Add Quarter addquarter(date_column, num_of_quarters) | This function will add the specified number of quarter(num_of_quarter) to the given date value. | addquarter('2013-08-27',10) = 2016-02-27 |
| Add Year addyear(date_column, num_of_years) | This function will add the specified number of year(num_of_year) to the given date value. | addyear('2013-08-27',10) = 2023-08-27 |
| Add Time - addtime(data_column, time) |
This function returns the day by adding the time to the given date column. | addtime ('2002/02/21 18:23:26', '01:20:10') = 2002/02/21 19:43:36 |
| Add Hours addhour(date_column, num_of_hours) | This function returns the day by adding the number of hours to the given date column. | addhour('2013-08-27',10) = 2013-08-27 10:00:00 |
| Add Minutes addminute(date_column, num_of_minutes) | This function returns the day by adding the number of minutes to the given date column. | addminute('2013-08-27',10) = 2013-08-27 00:10:00 |
| Add Seconds addsecond(date_column, num_of_seconds) | This function returns the day by adding the number of seconds to the given date column. | addsecond('2013-08-27',10) = 2013-08-27 00:00:10 |
| Peroid Add period_add(year_month, num_of_months) | Adds the specified number of months to the period and returns in the format 'yrmth'. | period_add(198608,6) = 198702 |
| Age Months age_months(from_date, to_date [Optional]) | This function returns the age in months between the two given date columns | age_months('2013-08-27','2014-06-28') = 10 |
| Age Years age_years(from_date, to_date [Optional]) | This function returns the age in months between the two given date columns | age_years('2013-08-27','2018-08-03') = 4 |
| Business Completion Day business_completion_day(from_date, num_of_days, exclude_weekends [Optional]) | This function returns the date adding the given number of days excluding the specified weekends. In case weekends is not provided, then Saturday and Sunday are considered as weekends by default. | business_completion_day('2018-01-01',10) = 2018-01-15 |
| Business Days business_days(from_date, to_date, exclude_weekends [Optional]) | This function returns the count of the business days between the two given date columns excluding specified weekends. In case weekends is not provided, then Saturday and Sunday are considered as weekends by default. | business_days('2018-01-27','2018-08-03') = 134 |
| Business Hours business_hours(from_datetime, to_datetime, work_start_time, work_end_time, exclude_weekends [Optional]) | This function returns the count of business hours in the business days between the two given datetime columns. In case weekends is not provided, then Saturday and Sunday are considered as weekends by default. | business_hours('2018-01-27 10:00:00','2018-08-03 08:00:00','09:00:00','10:00:00','1000001') = 134 |
| Convert String to Date convert_string_to_date(string_column, date_format_of_the_value) | Converts the string into date and returns it in the specified format. | convert_string_to_date('24/12/2009', '%d/%m/%Y') = 2009-12-24 |
| Convert to Datetime convert_to_datetime(string_column, date_format) | This function returns the date-time value by converting the given string. | convert_to_datetime('2013 Aug 27','yyyy MMM dd') = 27 Aug, 2013 |
| Convert TZ convert_tz(date_column, current_timezone_offset, timezone_to_be_converted_offset) | This function converts the timestamp or a date time value from one time zone to another. The parameters to specify the time zone can be given as Time Zone identifiers , Time Zone Abbreviations or Offsets. To consider the daylight savings during conversion automatically, use Time zone identifiers as parameters. |
|
| Current Date currentdate() | This function updates the current date of the computer or server automatically | currentdate() = 27 Sep, 2024 10:06:18 |
| Current Time current_time() | This function updates the current time automatically | current_time() = 27-11-2024, 14:30 |
| Current Timestamp current_timestamp() | This function updates the current date and time automatically | current_timestamp()=2024-11-27 14:30:15 |
| Now now() | This function updates the current date and time automatically | now()= 27 Sep, 2024 10:06:18 |
| Today today() | This function updates the current date automatically | today()=27 Sep, 2024 |
| Tomorrow tomorrow() | This function returns the date one day after the current date | tomorrow()=28 Sep,2024 |
| Yesterday yesterday() | This function returns the date for the previous day | yesterday()=26 Sep, 2024 |
| UTC date utc_date() | Returns the current UTC date. | utc_date()=27 Sep, 2024 |
| UTC time utc_time() | Returns the current UTC time. | utc_time()= 2024-11-27 14:30 |
| UTC date-time utc_timestamp() | Returns the current UTC date-time value. | utc_timestamp()= 2024-11-27 14:35:45 |
| Date date(date_column) | This function returns the date part of the given date and time value. | date('2013-08-07 14:15:16') = 2013-08-07 |
| Date Format date_format(date_column, date_format_to_be_converted) | This function returns the string form of the date for given date format. | date_format('2008-08-03','%W %M %Y') = Sunday August 2008 |
| Date and Time Diff - dateand timediff(Unit, From Date, To Date[optional] | This function returns the date and time difference between two date columns based on the units specified. The supported units are SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, YEAR. | dateandtimediff(DAY, '2015-01-01', '2015-05-01')=120 The above example returns the difference between the given dates in Days. |
| Date and Time Diff in Duration - datetime_diff_in_duration(date_column, date_column [Optional]) | Calculates the date-time difference between the given columns, and returns it as duration. |
|
| Date Diff datediff(date_column1, date_column2) | This function returns the difference between the two given date columns. | datediff('2011/8/11','2010/9/11') = 334 |
| Period Diff period_diff(year_month, year_month) | Returns the difference between two periods in months. | period_diff(198608,198602) = 2 |
| Day - day(date_column) | This function returns the day of the given date value. | day( '2024/11/27') = Wednesday |
| Day Name dayname(date_column) | This function returns the name of the weekday for the given date value(Sunday,Monday,...). | dayname('1990-08-07') = Tuesday |
| Day of Week dayofweek(date_column) | This function will return the number of the day of week of the given date value (Sunday = 1, Monday = 2,...). | dayofweek('2011/9/9') = 6 |
| Day of Month dayofmonth(date_column) | This function returns the day of the month for the given date value. | dayofmonth('1990-08-07') = 7 |
| Day of Quarter dayofquarter(date_column) | This function returns the count of days from the start day of the quarter to the given date value. | dayofquarter('2017-08-07') = 38 |
| Day of Year - dayofyear(date_column) | This function will return the number of the day of the year of the given date value (0 through 365). | dayofyear('2011/9/2') = 245 |
| Days Between days_between(from_date, to_date [Optional]) | This function returns the count of day between the two given date. | days_between('2018-01-27','2018-08-03') = 188 |
| End date end_day(date_units, date_column) | This function returns the end date for the given date value and date units. | end_day(month,'2018-08-27') = 2018-08-31 |
| First Date Current Week first_date_current_week(date_column, week_start_day [Optional]) | This function returns the day the current week begins with. You can choose to set the start day of your week in the parameter week_start_day by specifying 1 - Sunday, 2- Monday,... 7 - Saturday. By default Sunday is the first day of the week. | first_date_current_week('2013-10-11') = 2013-10-06 |
| From Unixtime - fromunixtime(seconds) | This function returns the unix time for the given seconds value. | fromunixtime('1000') = 1970/01/01 05:46:40 |
| Hour - hour(date_column) | This function returns the hour of the given date value. | hour('2011/8/7 10:35:23') = 10 |
| Last Day - lastday(date_column) | This function returns the last day of the month for the given date value. | lastday('2011/9/7') = 2011/9/30 |
| Last N Days last_nday(date_column, num_of_days) | This function returns a date that is N number of days before the given date. | last_nday('2018-08-04',15) = 2018-07-21 |
| Last N Months last_nmonth(date_column, num_of_months) | This function returns the date value for the given year and num_of_days values. | last_nmonth('2018-08-04',15) = 2017-06-04 |
| Next N Days next_nday(date_column, num_of_days) | Returns a date that is N number of days after the given date. This is calculated from a day after the given date. | next_nday('2018-08-04',15) = 2018-08-19 |
| Next N Month next_nmonth(date_column, num_of_months) | Returns a date that is N number of months after the given date. This is calculated from a day after the given date. | next_nmonth('2018-08-04',15) = 2019-11-04 |
| Next Weekday next_weekday(date_column, weekday) | Returns the next date when the specified weekday falls. | next_weekday('2018-08-01',1) = 2018-08-05 |
| Previous N Day previous_nday(date_column, num_of_days) | Returns a date that is N number of days before the given date. This is calculated from a day before the given date. | previous_nday('2018-08-04',15) = 2018-07-20 |
| Previous N Months previous_nmonth(date_column, num_of_months) | Returns a date that is N number of months before the given date. This is calculated from a day before the given date. | previous_nmonth('2018-08-04',15) = 2017-05-04 |
| Make Date - makedate(year,num_of_days) | This function returns the date value for the given year and number of the day value (0 through 365) | makedate('2011','23') = 2011/1/23 |
| Microsecond microsecond(date_column) | This function returns the microsecond value from the given date-time argument value. | microsecond('1990-08-07 10:35:23.3427') = 342700 |
| Minute - minute(date_column) | This function returns the minutes of the given date value. | minute('2011/8/7 10:35:23') = 35 |
| Second - second(date_column) | This function returns the seconds of the given date/time value. | second('2011/9/7 10:35:23') = 23 |
| Modified Time -modifiedtime() | This function returns the created time of the record (if the record is newly added) or the last modified time of the record. When you apply this function, initially it will return the time at which the formula has been created. Subsequently it will return only the modified time of the record. | |
| Month - month(date_column) | This function returns the name of the month of the given date value. | month('2011/9/7') = September |
| Month Name monthname(date_column) | This function returns the name of the month of the given date value. | monthname('2011/9/7') = September |
| Month Number - monthnum(date_column) | This function returns the number of the month of the given date value. | monthnum('2011/9/7') = 9 |
| Months Between months_between(from_date, to_date [Optional], iswhole_value [Optional]) | Returns the count of months in fractional value considering 31 days as a month. | months_between('2013-08-27','2018-08-03',1) = 59 |
| Quarter - quarter(date_column) | This function returns the quarter of the given date value. | quarter('2011/8/7') = Q3 |
| Quarter Name quartername(date_column, fiscal_start_month [Optional]) | Returns the quarter name of the given date value as a string. | quartername('1990-08-07') = Q3 |
| Quarter Number quarternum(date_column, fiscal_start_month [Optional]) | Returns the quarter of the given date in numeric format. | quarternum('1990-08-07') = 3 |
| Second to Time sec_to_time(seconds) | Converts the given number of seconds to time and returns it in hours, minutes and seconds. | sec_to_time(86399) = 23:59:59 |
| Second second(date_column) | Returns the seconds of the given date value. | second('1990-08-07 10:35:23') = 23 |
| Start Date start_day(date_units, date_column) | Returns the start date for given date value and date units. | start_day(month,'2018-08-27') = 2018-08-01 |
| Sub Date - subdate(date_column,num_of_days) | This function returns the date by subtracting the number of days(num_of_days) from the given date value. | subdate('2011/9/15','6') = 1990/9/9 |
| Sub Time - subtime(date_column,time) | This function returns the date by subtracting the time from the given date with time value. | subtime('2011/02/21 18:23:26','01:20:10') = 2011/02/21 17:03:16 |
| Time time(date_column) | Returns the time value of the given date-time value argument. | time('2013-08-07 14:15:16') = 14:15:16 |
| Time Format time_format(time, time_format_to_be_converted) | Converts the time to the specified format and returns the same. | time_format('19:30:41.32','%H %h %i %s %f') = 19 07 30 41 320000 |
| Time to Sec time_to_sec(date_column) | Converts the time value in hours and minutes to seconds and returns the same. | time_to_sec('2013-08-07 14:15:16') = 51316 |
| Time Diff timediff(to_date, from_date) | Returns the difference between two time values passed in the 2 arguments. | timediff('1990-08-17 16:15:14','1990-08-17 14:15:16') = 01:59:58 |
| Timestamp timestamp(date_column) | Returns the date time expression for a given date value. | timestamp('2008-11-05') = 2008-11-05 00:00:00 |
| Timestamp Add timestampadd(unit, numeric_column, date_column) | Returns the date time after adding the specified number of interval. | timestampadd(week,1,'2008-11-05 19:00:00') = 2008-11-12 19:00:00 |
| Timestamp Diff timestampdiff(unit, from_date, to_date) | Subtracts the first argument from the second argument and returns the value in the specified unit. | timestampdiff(year,'2002-05-01','2001-01-01') = -1 |
| Timestamp Diff in Duration - timestamp_diff_in_duration(date_column, date_column) | Calculates the date time difference between the given timestamp columns and returns it as duration. | timestamp_diff_in_duration('1990-08-17 16:15:14', '1990-08-17 14:15:16') = 0.1:59:58 |
| Unix Timestamp unix_timestamp(date_column [Optional]) | Calculates the total number of seconds fromï¿1⁄2 the date '1970-01-01 00:00:00' to the given date-timeï¿1⁄2 and returns the same. | unix_timestamp('2018-10-10 12:35:45') = 1539174945 |
| Week week(date_column) | Returns the week of the given date. | week('2008-01-14') = 2 |
| Weekday weekday(date_column) | Returns weekday of the given date value. | weekday('1990-08-07') = Tuesday |
| Week of Month weekofmonth(date_column) | Returns the week number of the month for the given date value. | weekofmonth('2008-01-14') = 3 |
| Week of Year weekofyear(date_column, week_start_day [Optional], week_mode [Optional], fiscal_start_month [Optional] | Returns the week number of the given date as numeric value. | weekofyear('1990-08-07') = 32 |
| Year - year(date_column) | This function returns year from the given date value. | year('2011/9/7') = 2011 |
| Year Week yearweek(date_column) | Returns the year and week of the given date. | yearweek('2008-01-14') = 200802 |
Note: Date relative functions like modified_time(), today(), now() always returns values in GMT. To match them with your local time zone, use the convert_tz() function and apply the appropriate time offset.
Duration Functions
Numeric Functions
| FUNCTION | DESCRIPTION | EXAMPLE |
| Abs - abs(numeric_column) | This function returns the absolute value (number without sign) of the 'numeric_column' | pi() = 3.14159265358979 |
| Acos - acos(numeric_column) | This function returns the arc cosine value of the specified 'numeric_column'. Returns NULL if the 'numeric_column' is not in the range-1 to 1. | pow(2,3) = 8 |
| Asin - asin(numeric_column) | This function returns the arc sine value of the specified 'numeric_column'. Returns NULL if the 'numeric_column' is not in the range-1 to 1. | rand() = 0.282164005825449 |
| Atan - atan(numeric_column) | This function returns the arc tangent value of the specified 'numeric_column'. | atan(2) = 1.107149 |
| Atan2 - atan2(numeric_column1, numeric_column2) | This function returns the arc tangent of the specified columns 'numeric_column1' / 'numeric_column2 | atan2(0.8, 0.6) = 0.927295 |
| Ceil - ceil(numeric_column) | This functions rounds the 'numeric_column' to the nearest integer which is greater than the 'numeric_column' | ceil(11.56) = 12 |
| Ceiling ceiling(numeric_column) | Returns the smallest integer that is greater than or equal to the value of the argument. | ceiling(10.43) = 11 |
| Conv conv(column, current_base, to_be_converted_base) | Converts the number string from the given base to the required base. | conv('a',16,2) = 1010 |
Convert base convertbase(column, current_base, to_be_converted_base) | Returns the converted string representation of the number N, from current base to the to be converted base. | convertbase('a',16,2) = 1010 |
| Cos - cos(numeric_column) | This function returns the cosine value of the specified 'numeric_column' | cos(0) = 1 |
| Cot - cot(numeric_column) | This function returns the cotangent value of the specified 'numeric_column' | cot(0.25) = 3.916317 |
| CRC32 crc32(string_column) | Returns a 32 bit unsigned output after calculating the cyclic redundency check. | crc32('111') = 1298878781 |
| Degrees - degrees(numeric_column) | This function returns the angle in Degrees equivalent to the given Radians | degrees(1) = 57.2957795 |
| Exp - exp(numeric_column) | This function returns the exponential value of the 'numeric_column' | exp(2) = 7.389056 |
| Floor - floor(numeric_column) | Rounds the 'numeric_column' to the nearest integer which is less than the 'numeric_column' | floor(11.56) = 11 |
| Format format(numeric_column1, numeric_column2) | Formats the number by rounding off the number to decimal places specified in the second argument and returns the value. | format(1.0001111,5) = 1.00011 |
| Greatest - greatest(numeric_column,..., numeric_column) | Gives the greatest of the given arguments. | greatest(10,20,5) = 20 |
| Least - least(numeric_column,..., numeric_column) | Gives the least of the given arguments. | log10(3) = 0.477121 |
| Ln - ln(numeric_column) | This function returns the natural logarithm of the specified 'numeric_column' | ln(5) = 1.609438 |
| Log log2(numeric_column) | Returns the logarithm to the base-2 of the numeric column. | log2(32) = 5 |
| Log10 - log10(numeric_column) | This function returns the logarithm to the base-10 of the specified 'numeric_column' | log10(3) = 0.477121 |
| Log2 - log2(numeric_column) | This function returns the logarithm to the base-2 of the 'numeric_column | log2(32) = 5 |
| Mod - mod(numeric_column1, numeric_column2) | Returns the remainder of the 'numeric_column1' divided by 'numeric_column2' | mod(10,3) = 1 |
| OCT oct(column) | Returns the octal value of the number given in the argument. | oct(12) = 14 |
| Pi - pi() | This function returns the numeric value of the pi. | pi() = 3.14159265358979 |
| Power - pow(numeric_column1, numeric_column2) | This function returns the value of 'numeric_column1' raised to the power of 'numeric_column2' | pow(2,3) = 8 |
| Random - rand() | Returns a random value between 0 and 1. | rand() = 0.9233482386203 |
| Radians - radians(numeric_column) | Returns the angle in radians equivalent to the given degrees | radians(180) = 3.1415926 |
| Round - round(numeric_column) | Returns the rounded integer value of the 'numeric_column'. | round(10.67) = 11 |
| Sign - sign(numeric_column) | Returns-1, 0, or 1, if the 'numeric_column' is negative, zero, or positive. | sign(-23) =-1 |
| Sin - sin(numeric_column) | Returns the sine value of the 'numeric_column'. | sin(0) = 0 |
| Square - square(numeric_column) | Returns the square of the specified 'numeric_column'. | square(10) = 100 |
| Square Root - sqrt(numeric_column) | Returns the square root of the specified 'numeric_column'. | sqrt(16) = 4 |
| Tan - tan(numeric_column) | Returns the tangent value of the specified 'numeric_column'. | tan(0.5) = 0.546302 |
String Functions
Logical Functions
| FUNCTION | DESCRIPTION | EXAMPLE |
| IF - if(expr1,expr2,expr3) | Returns expr2 if expr1 is true else it returns expr3 | if(5> 10,100,3) = 3 |
| If Case if_case(column, matchExpr1, returnValue1, matchExpr2, returnValue2, ..., elseValue [Optional]) | Returns the 'returnValue' if the given column satisfied with 'matchExpr'. | if_case('Subject','issue','Issue List',equals('bug'),'Bug List','Support List') = if the 'Subject' column equals issue then it returns 'Issue List' else if 'Subject' column equals 'bug' then it returns 'Bug List' else it returns 'Support List' if_case('Subject',startswith('issue','bug'),'Issue List',contains('help','Call'),'Call List','Support List') = if the 'Subject' column starts with 'issue' or 'bug' then it returns 'Issue List' else if 'Subject' column contains 'help' or 'Call' then it returns 'Call List' else it returns 'Support List' |
| Ifnull - ifnull(expr1,expr2) | Returns expr1 if expr1 is not null, else it return expr2 | ifnull(null,10) = 10 |
| Is Empty isempty(column) | Returns '1' if the given column does not have any value. Returns '0' if the given column have some value. | isempty(null) = 1 |
| isnull( ) - isnull(expr1) | Returns 1 if expr1 is null, else it returns 0. | isnull(null)- 1 |
Geo Spatial Functions
| FUNCTION | DESCRIPTION | EXAMPLE |
| ST Makepoint - make_point(numeric_column1, numeric_column2) | Returns a GeoJSON Point for the given latitude and longitude values. | make_point(0, 0) = [0 0] |
| ST Makeline - make_line(column1, column2) | Returns a GeoJSON LineString for the given array of coordinate pairs. | make _line(make_point(0,0), make_point (1,1)) = [[0 0] [1 1]] |
| ST Buffer - st_buffer(geometry, distance, distance_units [Optional]) | Creates a buffer polygon surrounding the given geometry based on a specified distance. | st_buffer(geometry, 10, 'm') st_buffer(geometry, 5, 'km') st_buffer(geometry, 3) (uses default unit 'm') |
| ST Area - st_area(geometry, distance_units [Optional]) | Computes the area of the specified geometry (such as a polygon or multi-polygon). | st_area(polygon_geom, 'km') = 0.025 st_area(polygon_geom, 'mi') = 0.00965 st_area(polygon_geom) = 25000 (uses default unit 'm') |
| ST Distance - st_distance(geometry1, geometry2, distance_units [Optional]) | Calculates the shortest distance between two geometries. | st_distance(polygon1, polygon2, 'm') = 120.5 st_distance(make_point(0, 0),make_point(1, 1), 'km') = 0.12 st_distance(make_line(make_point(0, 0), make_point(1, 1)), make_line(make_point(2, 2), make_point(3, 3)), 'mi') = 0.08 st_distance(point1, point2) = 120.5 (uses default unit 'm') |
| ST Intersect - st_intersects(geometry1, geometry2) | Checks whether two geometries spatially intersect (i.e., share any portion of space). | st_intersects(polygonA, polygonB) = 1 (intersecting) st_intersects(make_line(make_point(0, 0), make_point(1, 1)), polygon) = 0 (not intersecting) st_intersects(make_point(0, 0), polygon) = 1 (point lies inside the polygon) |
| ST_Centroid - st_centroid(geometry) | Returns the centroid (geometric center point) of the input geometry. | st_centroid(make_line(make_point(12, 7), make_point(100, 214))) = [56, 110.5] st_centroid(polygon) = [88.1, 45.7] |
General Functions
| FUNCTION | DESCRIPTION | EXAMPLE |
To Email Syntax: to_email(column) | Converts the plain text column in email format to email datatype. | to_email(test@abc.com) = test@abc.com |
To Currency Syntax: to_currency(numeric_column) | Converts the numeric column to currency data type, | to_currency(3854) = $3854 |
To Percentage Syntax: to_percentage(numeric_column) | Converts the numeric column to percentage datatype. | to_percentage(83) = 83% to_percentage(83.54) = 83.54% |
To positive integer Syntax: to_positive_integer(column) | Converts the negative values in the numeric column to positive number datatype. | to_positive_integer(-40) = 40 |
To decision box Syntax: to_decision_box(column) | Converts plain text values and boolean values like yes, no, true, false, on, off, 1 and 0 to decision box (Yes/No) data type. Values other than the above mentioned value will be returned as Null. | to_decision_box(yes) = Yes |
Coalesce Syntax: coalesce(column1, column2,...) | Returns the first non-null value. Returns null if all the values are null. | coalesce(null,null,4) = 4 |