When you start to create your own custom metrics and attributes, you'll use functions a lot to help you perform comparisons, calculations, and manipulations to your business information.
Explore offers many functions to help you work with, for example, dates, text strings, calculations and more. Use this article as a reference to help you discover the available functions and how to use them.
This article contains the following topics:
Getting started
You can browse for, and select functions when you create a standard calculated metric or attribute. In the formula editing window, you can either begin to type the name of a function or click Add under Functions and choose your function from the list.
When the function is added to a formula, it will appear with standard values. You must replace these with the values you want to use in your formula. In this example, you want to return only your tickets with subject lines beginning with "[Flagged]".
 In the calculations menu (), click Standard calculated attribute.
 Name your calculated attribute. This example uses Subject begins with [Flagged].
 Under Functions, click Add.
 In the formula window, type IF .
 Under Functions, click Add.
 Search for LEFTPART. Either use the search box, click Filter to scope the values down to the Text category, or scroll through the list until you find the function you want.
 Next to LEFTPART, click +.
 You'll now see the formula IF LEFTPART(_text,_number). Change the
_text parameter to the Ticket Subject attribute. Either highlight
_text and then choose Ticket subject from the Fields
menu, or amend the formula manually to add the attribute.
The formula will now read IF LEFTPART([Ticket subject],_number)
 Change the text _number to the number of characters you want to compare.
[Flagged] has nine characters, so enter 9.
The formula will now read IF LEFTPART([Ticket subject],9)
 Finally, add the condition we are searching for; in this case, the text
"Flagged". The final formula will read:
IF LEFTPART([Ticket subject],9)="Flagged" THEN [TicketID] ENDIF
Now, when you use this attribute in your report, it will only return tickets with a subject line beginning "[Flagged]"
For more help and examples, see Writing Explore formulas.
Basic mathematical operators
In addition to the above functions, you can also use the following basic mathematical operators to perform calculations and connect text:
Operator  Description 
+  Add two numeric values, or join two text strings. 
  Subtract one value from another. 
*  Multiply two values 
/  Divide one value by another 
=  Test if one value is equal to another value 
!=  Test if one value is not equal to another value 
> 
Test if the first value is greater than the following value (x>y) 
< 
Test if the first value is less than the following value (x<y) 
>= 
Test if the first value is greater than or equal to the following value (x>=y) 
<= 
Test if the first value is less than or equal to the following value (x<=y) 
%  Computes the modulo (or remainder) after dividing one value by
another. Example: 5%2 returns 1, 20%3 returns 2 
Logical functions
These functions give you great flexibility in analyzing and presenting your information just how you want.
Function  Description 
IF THEN ELSE Conditional expression  Enables you to evaluate logical values. Format: IF (condition) THEN (value if true) ELSE (value if false) ENDIF For indepth information about this function, see Using the IF THEN ELSE function. 
AND  Returns TRUE if the two supplied expressions are
TRUE. Example: IF ([Ticket channel]="Email") AND ([Submitter email]="fred@fredco.com") THEN [Ticket ID] ENDIF Returns all tickets that were received via. email from fred@freedco.com. 
OR  Returns TRUE if at least one of the supplied expressions is
TRUE. Example: IF ([Ticket channel]="Email") OR ([Ticket channel]="Voice") THEN [Ticket ID] ENDIF Returns all tickets that were received through either the email or voice channels. 
NOT  Reverses the logical value of the supplied
expression. Example: IF NOT([Ticket channel]="Email") THEN [Ticket ID] ENDIF Returns all tickets that were not received through the email channel. 
TRUE  Returns the logical value "TRUE". 
FALSE  Returns the logical value "FALSE" 
IN(_param,_array)  Returns TRUE if the first entered parameter is in the array specified
in the second parameter. Examples: IN(200,ARRAY(100,200,300,400)) returns TRUE IN(250,ARRAY(20,40,60,80)) returns FALSE 
SWITCH Conditional expression  SWITCH provides an easiertounderstand alternative to IF THEN ELSE
statements that have multiple branches. SWITCH (_tested_element) { CASE _value1: _return_value CASE _value2: _return_value DEFAULT: _default_return_value } For indepth information about this function, see Adding multiple conditional expressions with SWITCH. 
Attribute functions
These functions let you perform basic operations to quantify the number of attributes returned by your report. You can also perform more advanced operations to "lock in" or extend the aggregation level of your calculations.
Function  Description 
COUNT_VALUES(_attribute)  Counts the number of values of the attribute you supply. Repeat values
are included. Can be used as a condition in calculated attributes and
metrics, but cannot be used in the THEN clause of a calculated
metric. Example: IF COUNT_VALUES([Ticket ID])>30 THEN 1 ELSE 0 ENDIF The example above returns 1 when there are more than 30 tickets, and 0 when there are fewer than 30. Tip: If you want to create a metric
that counts the number of the values of an attribute, the metric
formula should be simply [Attribute]. You can then apply the COUNT aggregator
as normal.

DCOUNT_VALUES(_attribute)  Counts the distinct number of different values of the attribute you
supply. Can be used as a condition in calculated attributes and metrics, but
cannot be used in the THEN clause of a calculated metric. Example: IF COUNT_VALUES([Organization name])>100 THEN 1 ELSE 0 ENDIF The example above returns 1 when there are more than 100 distinct organizations, and 0 when there are fewer than 100. Tip: If you want to create a metric
that counts the number of distinct values of an attribute, the
metric formula should be simply [Attribute]. You can then apply the D_COUNT
aggregator as normal.

ATTRIBUTE_FIX(aggregator(metric name), attribute1, attribute2) 
Returns the value of aggregator(metric name) aggregated by the attributes you specify (in this example attribute1 and attribute2). No other attributes can affect the results from this metric. Calculated attributes can’t be used inside of the ATTRIBUTE_FIX function. Example: ATTRIBUTE_FIX(MED(First Reply Time (min), [Ticket created  Year], [Ticket created  Month]) For more help and examples, see Working with aggregation level functions. 
ATTRIBUTE_ADD(aggregator(metric name), attribute1, attribute2) 
Returns the value of aggregator(metric name) aggregated to all attributes in the report in addition to attribute1 and attribute2. Calculated attributes can’t be used inside of the ATTRIBUTE_ADD function. Example: ATTRIBUTE_ADD(MED(First Reply Time (min), [Ticket created  Year], [Ticket created  Month]) For more help and examples, see Working with aggregation level functions. 
Tag functions
These functions help you search for the presence or absence of tags. This can include ticket tags, call tags, or anything else that uses tags.
Function  Description 
INCLUDES_ALL([tag attribute], "tag1",
"tag2") or INCLUDES([tag attribute], "tag1", "tag2") 
Returns TRUE if all of the specified tags are included in the tag
attribute. Examples: INCLUDES_ALL([Ticket tags], "London", "Milan") returns TRUE if a ticket contains the tags "London" and "Milan". NOT INCLUDES_ALL ([Ticket tags], "London", "Milan") returns TRUE if a ticket does not contain both of the tags "London" and "Milan". For more examples of how to use this function, see Reporting with tags. 
INCLUDES_ANY([tag attribute], "tag1", "tag2")  Returns TRUE if any of the specified tags are included in the tag
attribute. Examples: INCLUDES_ANY([Ticket tags], "London", "Milan") returns TRUE if a ticket contains the tags "London" or "Milan". NOT INCLUDES_ANY ([Ticket tags], "London", "Milan") returns TRUE if a ticket does not contain either of the tags "London" or "Milan". For more examples of how to use this function, see Reporting with tags. 
Text functions
These functions enable you to perform operations that search and evaluate text. You can also modify text using formulas and patterns you create.
For examples of how to use some of these text functions (like CONTAINS, LEFTPART, SUBSTR, FIND, and LENGTH) see Explore recipe: Reporting on nested dropdown fields.
Function  Description 
CONTAINS(_text,_text_to_search)  Returns TRUE if the first entered parameter contains the second one as
a substring. Example: CONTAINS([Submitter name],"Sally")

ENDSWITH(_text,_text_to_search)  Returns TRUE if the first supplied text ends with the second supplied
text. Example: ENDSWITH([US State],"ippi") returns TRUE for Mississippi, but FALSE for Delaware. 
FIND(_text,_text_to_find,_number_start_index) 
Returns the index, in the first entered text, of the first instance of the second entered text, from the entered start index. Returns 1 if the second entered text is not found. The index of the first character of a string is 0. Examples: If [Ship Mode]="Urgent" then FIND([ShipMode","Norm",0) returns 1 If [Ship Mode]="Normal" then FIND([ShipMode","ma",0) returns 3 If [Ship Mode]="Urgent" then FIND([ShipMode","ge",2) returns 0 
LEFTPART(_text,_number)  Returns the leftmost _number of characters in the supplied
text. Example: If [Department]="Technical documentation" then LEFTPART([Department],9) returns "Technical" 
LENGTH(_text)  Returns the length (number of characters) of the supplied
text. Example: LENGTH([Product category]) returns the length of each value of the Product category attribute. 
LOWERCASE(_text)  Converts and returns the supplied text in lower case. 
LTRIM(_text)  Returns the supplied attribute value with any whitespace to the left
removed. Example: LTRIM([Name]) would return "Peter " if [Name] is " Peter " 
REPLACE(_text,_text_to_replace,_text_to_replace_with)  Returns a copy of _text in which all instances of
_text_to_replace have been replaced with
_text_to_replace_with. Example: IF [US State]="new York" then REPLACE([US State],"n","N") returns "New York" 
RIGHTPART(_text,_number)  Returns the rightmost _number of characters in the supplied
text. Example: If [Department]="Technical documentation" then RIGHTPART([Department],13) returns "documentation" 
RTRIM(_text)  Returns the supplied attribute value with any whitespace to the right
removed. Example: TRIM([Name]) would return " Peter" if [Name] is " Peter " 
STARTSWITH(_text,_text_to_search)  Returns TRUE if the first supplied text starts with the second supplied
text. Example: STARTSWITH([US State],"Miss") returns TRUE for Mississippi, but FALSE for Delaware. 
IS_POSITIVE(_text)  Returns TRUE for positive and FALSE for negative based on analysis of the text. 
SUBSTR(_text,_number_start_index,_number_end_index) 
Returns part of _text consisting of the character specified by start index (the first entered integer) and all characters up to end index1 (the second entered integer). Example: SUBSTR("Web marketing",0,3) returns "Web" 
TRIM(_text)  Returns the supplied attribute value with any whitespace to the left or
right removed. Example: TRIM([Name]) would return "Peter" if [Name] is " Peter ": 
UPPERCASE(_text)  Converts and returns the supplied text in upper case. 
STRING(_number)  Converts the supplied number into a string. 
LPAD(_text,_length,_pad)  Pads text to the left of _text with _pad until the string
is at _length. Example: LPAD("1",7,"?") returns "??????1" 
RPAD(_text,_length,_pad)  Pads text to the right of _text with _pad until the
string is at _length. Example: RPAD("1",7,"?") returns "1??????" 
LINK(_url,_label)  Returns a HTML link pointing to the supplied URL. For an example, see Explore recipe: Configuring clickable links to tickets. 
Regex functions
A regular expression (sometimes known as a regex or regexp) is a sequence of characters that define a search pattern. Explore contains support for using regular expressions to accomplish the following calculations in your formulas:
Function  Description 
REGEXP_MATCH(_text,_regexp)  Returns true if the text matches the regular expression. 
REGEXP_EXTRACT(_text,_regexp)  Returns the portion of text that matches the capturing group in the regular expression. For an example of how to use this function, see Can I report on user email domain in Explore? 
REGEXP_REPLACE(_text,_regexp,_replace_text)  Returns a string where any substring of text that matches the regular
expression is replaced by replace_text. Example: REGEXP_REPLACE("Hello","lo","p") returns "Help" 
For more information about regular expressions, see this Wikipedia page.
Date functions
Explore lets you create, compare, and perform calculations on dates and times. These functions are particularly useful because you'll likely spend a lot of time examining your company information over a chosen date range.
Function  Description 
DATE(_text)  Converts the supplied text into a date with a UTC timestamp. The
entered text can be in a variety of formats, but must at least include the
month, day, and year. Examples:

DATE_EQUAL(_date,_date)  Returns TRUE if the two entered dates are equal. Example: IF DATE_EQUAL([Ticket Created  Month],[Ticket Solved  Month]) THEN [Ticket ID] ENDIF Returns all tickets that were solved in the same month they were created. The year isn't included in this example so a ticket that was created in June 2018 and solved in June 2020 would be returned by this example. 
DATE_NOT_EQUAL(_date,_date)  Returns TRUE if the two entered dates are not equal. Example: IF DATE_EQUAL([Ticket Created  Month],[Ticket Solved  Month]) THEN [Ticket ID] ENDIF Returns all tickets that were not solved in the same month they were created. 
DATE_LESS(_date,_date)  Returns TRUE if the first date is earlier than the second
date. Example: IF DATE_LESS([Ticket Assigned  Date],[Ticket Due  Date  Date]) THEN [Ticket ID] ENDIF Returns all tickets that were assigned before their due date. 
DATE_LESS_OR_EQUAL(_date,_date)  Returns TRUE if the first date is earlier or the same as the second
date. Example: IF DATE_LESS_OR_EQUAL([Ticket Assigned  Date],[Ticket Due  Date  Date]) THEN [Ticket ID] ENDIF Returns all tickets that were assigned before or on their due date. 
DATE_GREATER(_date,_date)  Returns TRUE if the first date is later than the second
date. Example: IF DATE_GREATER([Ticket Assigned  Date],[Ticket Due  Date  Date]) THEN [Ticket ID] ENDIF Returns all tickets that were assigned after their due date. 
DATE_GREATER_OR_EQUAL(_date,_date)  Returns TRUE if the first date is later or the same as the second
date. Example: IF DATE_GREATER_OR_EQUAL([Ticket Assigned  Date],[Ticket Due  Date  Date]) THEN [Ticket ID] ENDIF Returns all tickets that were assigned on or after their due date. 
DATE_ADD(_date,_date_part,_increment) 
Returns the given date in the user's time zone, updated by the entered increment. The _date_part parameter could be for example, 'year', 'quarter', 'month', 'day', 'hour', etc. The entered increment must be an integer value, but it can be negative. 
DATE_DIFF(_date,_date,_date_part)  Returns the relative or exact difference between two dates in the
format you choose. In the function, _date_part can be one of the
following: For relative differences (whole numbers):
For exact values:
Examples: DATE_DIFF("2011/10/22","2008/01/06","year") returns 3 (20112008) DATE_DIFF("2011/10/22","2008/01/06","nb_of_years") returns 4 (actual count of years) DATE_DIFF("2019/03/06","2019/03/05","day") returns 1 DATE_DIFF("2019/03/06","2017/03/05","nb_of_days") returns 731 
DATE_FORMAT(_date,_format)  Returns the entered date in the user's time zone in the supplied
format. For a list of the formats you can use, see Formatting dates. 
TODAY()  Returns the current date in the user's time zone. 
NOW()  Returns the current date and time in the user's time zone (in hours, minutes, and seconds). 
CURRENT_YEAR()  Returns the current year. 
CURRENT_HALFYEAR()  Returns the current semester as "H1" or "H2" 
CURRENT_QUARTER()  Returns the current quarter as "Q1", "Q2", "Q3", or "Q4" 
CURRENT_MONTH()  Returns the current month, for example "January", "February". 
CURRENT_MONTH_NUMERIC()  Returns the current month as a number, for example "1" for January, "2" for February. 
CURRENT_DAY()  Returns the current day as a number. 
CURRENT_WEEKDAY()  Returns the current day of the week as text, for example "Monday", "Tuesday". 
CURRENT_WEEKDAY_NUMERIC()  Returns the current day of the week as a number, for example "0" for Sunday, "1" for Monday. 
CURRENT_HOUR()  Returns the current hour in the user's time zone as a number. 
CURRENT_MINUTE()  Returns the current minute in the user's time zone as a number. 
CURRENT_SECOND()  Returns the current second in the user's time zone as a number. 
YEAR(_date)  Returns the year of the supplied date. 
MONTH(_date)  Returns the month of the supplied date as text, for example "January", "February" 
MONTH_NUMERIC(_date)  Returns the month of the supplied date as a number, for example "1" for January, "2" for February. 
DAY(_date)  Returns the day of the supplied date. 
WEEKDAY(_date)  Returns the day of the supplied date as a string, for example "Monday", "Tuesday". 
WEEKDAY_NUMERIC(_date)  Returns the day of the supplied date as a number, for example "1" for Sunday, "2" for Monday. 
HOURS(_date)  Returns the hour of the supplied date. 
MINUTES(_date)  Returns the minute of the supplied date. 
SECONDS(_date)  Returns the second of the supplied date. 
WEEK_NUMBER(_date)  Returns the week number associated with the supplied date. See Understanding how the start of the week affects week numbers. 
WEEK_NUMBER_MONDAY(_date)  Returns the week number associated with the supplied date starting on Monday. 
WEEK_NUMBER_FRIDAY(_date)  Returns the week number associated with the supplied date starting on Friday. 
WEEK_NUMBER_SATURDAY(_date)  Returns the week number associated with the supplied date starting on Saturday. 
WEEK_NUMBER_SUNDAY(_date)  Returns the week number associated with the supplied date starting on Sunday. 
START_OF_QUARTER(_date)  Returns the start of the quarter for the supplied date. 
END_OF_QUARTER(_date)  Returns the end of the quarter for the supplied date. 
START_OF_MONTH(_date)  Returns the start of the month for the supplied date. 
END_OF_MONTH(_date)  Returns the end of the month for the supplied date. 
START_OF_WEEK(_date)  Returns the start of the week for the supplied date. See Setting the start of the week for reports and filters. 
END_OF_WEEK(_date)  Returns the end of the week for the supplied date. See Setting the start of the week for reports and filters. 
START_OF_WEEK_MONDAY(_date)  Returns the start of the week that matches the supplied date with the week starting on Monday. 
END_OF_WEEK_MONDAY(_date)  Returns the end of the week that matches the supplied date with the week starting on Monday. 
START_OF_WEEK_FRIDAY(_date)  Returns the start of the week that matches the supplied date with the week starting on Friday. 
END_OF_WEEK_FRIDAY(_date)  Returns the end of the week that matches the supplied date with the week starting on Friday. 
START_OF_WEEK_SATURDAY(_date)  Returns the start of the week that matches the supplied date with the week starting on Saturday. 
END_OF_WEEK_SATURDAY(_date)  Returns the end of the week that matches the supplied date with the week starting on Saturday. 
START_OF_WEEK_SUNDAY(_date)  Returns the start of the week that matches the supplied date with the week starting on Sunday. 
END_OF_WEEK_SUNDAY(_date)  Returns the end of the week that matches the supplied date with the week starting on Sunday. 
DATE_FROM_TIMESTAMP(_timestamp)  Returns a date from a supplied UNIX timestamp in seconds. 
DATE_FROM_MILLI_TIMESTAMP(_timestamp)  Returns a date from a supplied UNIX timestamp in milliseconds. 
DATE_TO_TIMESTAMP(_date)  Returns a UNIX timestamp in the user's time zone from a supplied date. 
DATE_TO_MILLI_TIMESTAMP(_date)  Returns a UNIX timestamp in milliseconds from a supplied date. 
SECONDS_TO_TIME(_time)  Converts seconds to HH:MM:SS format. 
FISCAL_YEAR(_date,_start_month)  Returns the fiscal year based on the supplied date and start month. The month parameter must be the full name of the month (e.g., "February", not "Feb"). 
FISCAL_QUARTER(_date,_start_month)  Returns the fiscal quarter based on the supplied date and start month. The month parameter must be the full name of the month (e.g., "February", not "Feb"). 
FISCAL_WEEK_NUMBER(_date,_start_month)  Returns the fiscal week number based on the supplied date and start month. The month parameter must be the full name of the month (e.g., "February", not "Feb"). 
WEEKYEAR(_date)  Returns the year of the week number associated with the supplied date. 
DATE_FIRST(time attribute) 
Returns the earliest date or timestamp according to attributes added to the report and is affected by all applied filters. Example: DATE_FIRST([Update  Timestamp]) Returns the earliest update timestamp taking into account all attributes you added to the report. For more help and examples, see Working with earliest and latest date functions. 
DATE_LAST(time attribute) 
Returns the latest date or timestamp according to attributes added to the report and is affected by all applied filters. Example: DATE_LAST([Update  Timestamp]) Returns the latest update timestamp taking into account all attributes you added to the report. For more help and examples, see Working with earliest and latest date functions. 
DATE_FIRST_FIX(time attribute, attribute1, attribute2, ...) 
Returns the earliest date or timestamp according to the attributes specified in the function. Attributes added to the report will not affect the calculation but any filters applied will be taken into account. Example: DATE_FIRST_FIX([Update  Timestamp], [Update ticket ID]) Returns the earliest update timestamp per ticket, regardless of the attributes from the report. For more help and examples, see Working with earliest and latest date functions. 
DATE_LAST_FIX(time attribute, attribute1, attribute2, ...) 
Returns the latest date or timestamp according to the attributes specified in the function. Attributes added to the report will not affect the calculation but any filters applied will be taken into account. Example: DATE_LAST_FIX([Update  Timestamp], [Update ticket ID]) Returns the latest update timestamp per ticket, regardless of the attributes from the report. For more help and examples, see Working with earliest and latest date functions. 
Formatting dates
The DATE_FORMAT function render full timestamps as different types of dates. Each format is represented by a different letter. You enter the associated letter in the format part of the DATE_FORMAT function. Letters must be entered in double quotes. You can combine the date or time components to display more information about a date.
For example, to change the default format (20150127T13:21:10) of the Ticket created  Timestamp attribute to a USstyle format (Jan 27, 2015 01:21 PM), use this formula:
DATE_FORMAT([Ticket created  Timestamp],"Mon DD, YYYY hh:MI AM")
The table shows formats you can use. The examples use the timestamp 20171103T15:18:25.
Date or time component  Letter  Example using 20171103T15:18:25 
Year  YYYY  2017 
Year  YY  17 
Quarter  Q  Q4 
Month number  MM  11 
Month name  Mon  Nov 
Month name  Month  November 
Week of year (1–53)  WW  44 
Week of month (15)  W  1 
Day number of year (01366)  DDD  307 
Day number of month (0131)  DD  3 
Day name of week  Day  Friday 
Day name of week  Dy  Fri 
Hour in day (0112)  hh  3 
Hour in day (123)  HH  15 
Minutes  MI  18 
Seconds  SS  25 
Millisecond (000999)  MS  0 
Meridiem indicator (AM or PM)  AM  PM 
Numeric functions
These functions enable you to perform a wide range of mathematical calculations on the information in your reports.
Function  Description 
ABS(_number)  Returns the absolute value of the supplied number.
Examples: The absolute value of 1 is 1 The absolute value of 7.3 is 7.3 
BETWEEN(_number,_number,_number)  Returns TRUE if the first supplied number is between the two other
numbers. Example: BETWEEN(SUM(Profit),500,1500) returns TRUE if SUM(Profit) is equal to, or between 500 and 1500. 
CEIL(_number)  Returns the ceiling of the supplied number. The ceiling of a number is
its highest closest or equal integer. Examples: The ceiling of 125.4 is 126 The ceiling of 63.2 is 63 CEILING(SUM(First resolution time (min))) returns the highest closest integer to each first resolution time stored in the attribute. 
EXP(_number)  Returns the value of the base of the natural logarithm (e) to the power
of the supplied exponent. Example: EXP(SUM(Unit price)) returns the natural logarithm of each value of the SUM (Unit price) metric. 
FLOOR(_number)  Returns the floor of the supplied number. The floor of a number is its
lowest closest or equal integer. Examples: The floor of 125.4 is 125 The floor of 63.2 is 64 FLOOR(SUM(First resolution time (min))) returns the lowest closest integer to each first resolution time stored in the attribute. 
GROWTH_RATE(_number,_number)  Returns the growth rate corresponding to the two supplied
parameters. Example: If the two supplied parameters are X and Y, the growth rate is YX/ABS(X). 
INTEGER(_param)  Returns the integer of the supplied noninteger
number. Example: INTEGER(1.56) returns 1 
MAXIMUM(_number,_number)  Returns the largest of the two supplied
parameters. MAXIMUM(SUM(Revenues),SUM(Expenses)) returns the larger of Revenues and Expenses. 
MINIMUM(_number,_number)  Returns the smallest of the two supplied
parameters. MINIMUM(SUM(Revenues),SUM(Expenses)) returns the smaller of Revenues and Expenses. 
NUMBER(_param) 
Returns the number representation of the given parameter, or returns NaN when it cannot be displayed as a number. Examples: NUMBER("3.14116") returns 3.14116 NUMBER ([Box category]) returns the number of the current value of the Box category attribute. 
PI() 
Returns the mathematical constant for the ratio of the circumference of a circle to its diameter, expressed as PI. The value is 3.141592653589793. 
POWER(_number,_number)  Computes and returns the first supplied number to the power of the
second supplied number. Example: IF SUM(Unit Price)=2 then POWER(SUM(Unit Price),3) returns 8 
RANDOM() 
Returns a pseudorandom number 'n' where 0<=n<1. If you need a random integer, use the formula Round(Random()*100). 
ROUND(_number) 
Rounds the value of supplied number up or down to the nearest integer. If equidistant, the value is rounded up. 
SIGN(_number) 
Returns 1 if the number is negative, 0 if zero, and 1 if positive. 
SQRT(_number)  Computes and returns the square root of the supplied number. 
SQUARE(_number)  Computes and returns the square of the supplied number. 
LN(_number)  Returns the natural logarithm of the supplied number. 
LOG10(_number)  Returns the Base10 logarithm of the supplied number. 
LOG2(_number)  Returns the Base2 logarithm of the supplied number. 
LOG(_base,_number)  Returns the logarithm of the supplied number to the supplied base. 
Trigonometric functions
These functions help you to create advanced formulas for measuring angles and distances.
Function  Description 
ACOS(_number)  Computes the arc cosine of the entered number, in radians. 
ASIN(_number)  Computes the arc sine of the entered number, in radians. 
ATAN(_number)  Returns the value in radians of the angle with the tangent entered in the parameter. The value returned is between negative PI/2 and positive PI/2. 
ATAN2(_number,_number)  Returns the angle of the point Y/X in radians when measured counterclockwise from a circle's X axis (0,0 represents the center of the circle). The return value is between positive PI and negative PI. Enter the Y coordinate as the first parameter. 
COS(_number)  Computes the cosine of the entered number, in radians. 
DEGREES(_number)  Converts the given number from radians to degrees. 
RADIANS(_number)  Converts the given number from degrees to radians. 
SIN(_number)  Computes the sine of the entered number, in radians. 
TAN(_number)  Returns the tangent of the entered angle. 
URL functions
The following URL functions appear in the Explore function list, but are not currently used.
 HOST
 DOMAIN
 TLD
JSON functions
The following JSON functions appear in the Explore function list, but are not currently used.
 JSON_EXTRACT
 JSON_ARRAY_LENGTH
 JSON_EXTRACT_ARRAY_ELEMENT
Cryptography functions
Explore supports the following cryptography functions:
Function  Description 
HMAC(_algorithm,_output_format,_key,_message)  Returns a keyed hash value using the hashbased message authentication (HMAC) method. 
46 Comments
Our tickets have a multiselect field that we use to track the ticket escalation path through multiple tiers of support. If a ticket is assigned to one of those tiers, that tier's value will be added to the field for that ticket.
We would like to build a report that only shows the *maximum* escalation level for each ticket over time. So, for example, if a ticket has the values of both V1 and V2 for the field, we would like to *only* count the ticket on the chart as V2. Currently, when I build charts using this field we see tickets doublecounted, showing as both V1 and V2 (where the metric is Count(Tickets) and the Rows are the field in question).
How would I compose an Explore metric or attribute that only reports a single "maximum" value for a multiselect field for each ticket?
Ben
Try this:
Use the Ticket Updates dataset
Create a new Standard Calculated Metric to convert your dropdown menu to a number. If your dropdown values look like numbers, you can do this:
IF [Changes  Field name] ="Dropdown Number" then
NUMBER([Changes  New value])
ENDIF
In the above my custom dropdown field is named 'Dropdown Number' which would be your escalation custom field.
Now you can use a MAX aggregate to find the highest values:
So I believe the trick is to get your text drop down field as a number so you can manipulate it to find the highest value.
Hi Graeme,
Unfortunately, our values do not look like numbers, so I tried building a metric that maps the string values to integers via a switch statement, but I am not getting any results.
IF [Changes  Field name] = "Escalation Level" THEN
SWITCH [Changes  New value] {
CASE "Customer Service": 1
CASE "Product Support": 2
CASE "Engineering": 3
}
ENDIF
I have verified that the first ticket result does have some updates that should register:
Am I missing something obvious here?
Ben
In the Rows section, if you include the field 'Changes New Value' that will help validate the custom metric. The values returned here may be different from what you expected when writing your formula and the matching to you SWITCH/CASE statement is case sensitive.
Hi all,
How can I identify in explore the first Chat EngagenementID where an agent sent more than 0 messages? Ultimately I want to be able to use this to identify the First Engagement Dept for each chat so I can get volume related data for each Chat Department based on the First Dept that handled that chat.
I'd use the Chat Department, but this updates to the Final Engagement Department...
e.g. If a Chat Comes into Customer Service  and is then Transferred to Technical Support and then Advanced Support. This would be 1 Chat with ideally 3 engagements (one for each Dept). The Chat Department would end up as Advanced Support.
I want to be able to run a report that counts the number of chats that initially landed in Customer Service (or Tech Support or Advanced Support)
I initially tried trimming the ".1" from the engagementid suffix <ChatID>.1 for first engagement and using that to populate a new attribute using Engagement DEpt  but this is not reliable as if the first enagement is missed, then the engagement dept is null.
Hopefully I have been overthinking this and there's a simple way to accomplish what I am trying to do, but I've so far come up against dead ends. Any help appreciated!
Hi Graeme,
Thanks—it turns out that the change is reported as an underlying tag change rather than reporting the field value's human readable name, which is not optimal.
But at least I now know what to look for. However, this is difficult enough to deal with that I'm starting to consider other methods to record this fact.
Hi Graeme,
One final question—what I really want to do is build a graph of the *count* of each max value, so I can illustrate what percentage of each week's tickets where maximally escalated to each group.
Is it possible to build a metric that is a COUNT of a set of MAX values?
Ben
Sorry, but I am not sure how to do that.
There is a result manipulation>result metric calculation to perform additional calculations on your metrics, but you can only COUNT attributes not metrics.
How would I calculate if something previously existed in a state. For example: how many tickets were at one point tagged with a given tag, but may not necessarily have that tag still attached to them.
Hi  why does the WEEKDAY_NUMERIC() function not allow us to set the parameter for when the week starts? Even Excel lets us do this, this should be fundamental to an analytics tool.
Hi Jeff,
If the tags are associated with ticket field/filed values, then you should be able to you can track this by using the Changes attributes (Changes  Field name,  Previous value, and  New value) under the Ticket updates dataset. But, if what you are looking to track are just tags added to the tickets, then I'm afraid that is not possible at this time.
Thanks!
Hi Christopher,
I agree that this would be a very useful functionality if made available in Explore. Sorry if this weekday_numeric function falls a little bit short here.
For now, I recommend that you create a new post in the Explore Product Feedback topic in our community to engage with other users who have similar needs and discuss possible workarounds. Conversations with a high level of engagement may also get flagged for future roadmap planning.
Thanks!
I am running into issues trying to create custom metrics and excluding tickets that contain certain tags. My metrics work fine before testing for tags, and I have tried using "not contains" as an alternative. I am using d_count and the metrics otherwise works until the tag condition.
IF IN([Ticket created  Day of week],ARRAY("Monday", "Tuesday","Wednesday","Thursday","Friday","Saturday"))
AND IN([Ticket created  Hour],ARRAY("7", "8", "9", "10", "11", "12","13","14","15"))
AND (SUM(First reply time (min)) > 60)
AND NOT INCLUDES_ANY ([Ticket tags], "no_stats", "closed_by_merge")
THEN
[Ticket ID]
ENDIF
Any tips?
David
Sorry, but I cannot replicate your problem.
Sometimes it is best to tick the 'Compute separately' option when creating a custom metric if you have other metrics in your query. Perhaps worth a shot?
Graeme, you gave me the confidence that it should be working so I took it to another account and it worked fine there. I have submitted a support ticket to resolve. Thank you!
David
Please let me know if I have missed something.
Thank you!
Hello!
I am trying to create a custom metric to calculate the percentage of two custom fields. One of the custom fields is multiselect, but the other is not. I am looking for a 1:1 ratio so count values does not work for me because some tickets may have multiple values selected which is skewing the results. Is there a way to calculate the number of tickets with a value in this custom field instead?
Not sure what's changed, but looks like the DATE_FORMAT function stopped working correctly in the last week.
now returns a timestamp whenever day is included: 20210501T00:00:00
Hi Madeline,
Multiselect values are treated the same way as tags are in Explore so each multi select value within the field will appear as seperate attribute values when selected. As there can be multiple values that exist in your use case it might be best if you firstly created a seperate custom metric that could aggregate the ticket count as only one when any applicable multi select value is selected. You can use a simply custom metric like this example below to help you get started.
IF ([Multiselect] = "multi select value 1" OR [Multiselect] = "multi select value 2")
THEN [Ticket ID]
ENDIF
Once you created something like the above you should be all good to try and incorporate that custom metric in your original metric to perform the percentage calculation.
Hope that helps!
Best regards,
Nhia.
Hi Milton,
Thanks very much for bring this to our attention.
We're currently working on this resolving this behaviour but I will create a ticket on your behalf so we can update separately once we have things all sorted!
Best regards,
Nhia.
Is it possible to use the DATE_GREATER(_date,_date) function to specify any tickets created after a specific date? If so, how would we format the custom date?
For example, if I only want to see tickets after today, I want to do something like:
DATE_GREATER([Ticket created  Date],"07/30/2021")
or something to this effect. Obviously this doesn't work as I've tried it, as well as a few other date formatting possibilities without success. Is specifying a date possible?
Cheers,
@... Try using the following formula instead with a slightly different date format:
@... I think that worked, I'm seeing the number I'm moreorless expecting  thanks! However, in order to verify, I added rows to the query for ticket ID and date created just to verify none were prior to the date I set. Now I can't get any data to render. The amount of tickets the query is showing is <200 so Explore shouldn't have any issue creating a table for that number of rows but it keeps telling me that the query took too long to execute. Could this have to do with something wrong with the metric or why else might it be trying to show so many rows when the number of results is so small?
EDIT: Figured this out, it was my calculated metric, it had other conditions alongside the date one, so even though it was only returning <200 results, the amount of lines in the db being queried was >50,000. Initially this error was not being returned and I was just getting a blank area where the visualisation would normally render, so I didn't know what was going on. Cheers
What about more than and less than mathematical operators? Can I use them in conjunction with equal signs, or no?
Hi CJ,
Yes, you can use <= or >= in your metric formula. Example:Hi there!
I need to build a query to get the total time spent by agent on tickets!
For example:
Ticket ID 1 is created
TIER 1
Agent 1 receive the ticket, and he has it assigned during 1 day, the reassignee to Agent 2
Agent 2 has 3 days the ticket assigned, THEN solve it.
I need to get that in TIER 1 group the ticket ID #1 was 4 days since creation upon solving. Of those 4 days was 1 day with Agent 1 and 3 days with Agent 2.
I'm doing it like this in Tickets Updates Dataset but I think I'm doing it wrong:
This is the standard calculated metric I created:
IF ([Changes  Field name] = "group_id"
AND [Changes  Previous value]!=NULL
AND [Changes  New value]!="0")
THEN (VALUE(Total time spent (sec)))/3600
ENDIF
I hope you can help me :)
Hi there,
I'm looking for a function that forces explore to show the visible ticket values only and ignore any values that are not visible.
Sry that's hard to explain for me what I mean by visible. I'll try to explain it.
We use conditional fields function and different ticket forms.
Example:
An agent selects ticketform1 and selects a product from dropdown productcategory1 and safes the ticket.
Then the case changes due to further information by the requester.
The agent now selects ticketform2 and selects a product from dropdown productcategory2.
The agent does not delete the other ticketinformation (ticketform1, productcategory1).
Now I create a report that shows a list of ticket IDs and Product Categorys in a table.
As we have different dropdownfields with different productcategory fields I use a formula to combine the values in the table.
Formula:
[productcategory1] + "" + [productcategory2]
In general that works great BUT only if there is no double information in the ticket.
With the double information in the ticket a table can look like that:
How can I force the formula to ignore the value that's actually not visible in the ticket?
I was not able to find a function for that.
In order to check this further, I will create a ticket on your behalf. You'll receive an email shortly, so we can move on from there.
Have a nice day further 👋️
It doesn't seem that "less than" operators actually function correctly. It'd be really helpful if the article covered these, if they are supposed to work, and provided example of the expected syntax.
I'm seeing options in the editor that aren't listed here, like "VALUE" and "D_COUNT", which I'm assuming then are considered "aggregators", but they aren't listed on that page, either? https://support.zendesk.com/hc/enus/articles/4408845551258Workingwithaggregationlevelfunctions
Is there any reference guides for these parts of the formula?
Please sign in to leave a comment.