In Explore, you can write formulas that power custom metrics and attributes. For formulas to work correctly, they need to be properly constructed.
If your formula isn’t properly constructed, the formula editor displays an error message in real time as you write or edit the formula. The error message identifies the issue with the formula and, if possible, provides guidance about how to resolve the issue.
This article lists the error messages you might encounter in the formula editor and provides additional advice on fixing your formula, including examples of incorrect and correct formulas.
This article contains the following topics:
- General syntax error messages
- Data type error messages
- Metric aggregator error messages
- Other error messages
Related articles:
General syntax error messages
If you see the following error message, it means that some of the syntax in your formula is incorrect:
- "There’s an issue with the formula. Check your calculation syntax and try
again."
The most common reasons for this error are listed in the table below.
Reason | Incorrect formula | Correct formula |
---|---|---|
You opened but didn’t close a bracket or parenthesis. Or you closed more than you opened. | IF ([Ticket status] = "Solved")) THEN [Ticket ID] ENDIF | IF ([Ticket status] = "Solved") THEN [Ticket ID] ENDIF |
You opened but didn’t close the quotation marks. | [Ticket status] = "Solved | [Ticket status] = "Solved" |
You didn’t wrap the attribute in brackets. | Ticket status = "Solved” | [Ticket status] = "Solved” |
You didn’t add an aggregator in front of a metric. |
First reply time (min) |
SUM(First reply time (min)) |
You’re missing an essential part of the IF statement. In this example, the ENDIF is missing. |
IF ([Ticket status] = "Solved") THEN [Ticket ID] |
IF ([Ticket status] = "Solved") THEN [Ticket ID] ENDIF |
Data type error messages
The tables below show error messages related to data types that you might see in the formula editor, including incorrect and correct versions of a formula. For more information about data types, see Working with data types in Explore formulas.
The sections below cover data type error messages in:
Equal, not equal, and less than or greater than expressions
Error message | Incorrect formula | Correct formula |
---|---|---|
Can't use [Project stage] as text and 1 as number. Use the same type. | [Project stage]=1 |
[Project stage]="1" The same data type should be used on both sides of the equality expression. A value wrapped in quotation marks is considered text, but a number without quotation marks is a number. Because Project stage is a text attribute, the value should have quotation marks. |
Can't use [Ticket country] as text and [User country code] as number. Use the same type. | [Ticket country]!=[User country code] |
[Ticket country]!=[User country name] The same data type should be used on both sides of the inequality expression. Ticket country is text, so the attribute on the right should be text too. |
Can't use [Ticket assigned - Date] as text and 26 as number. Use only numbers or only text. | [Ticket assigned - Date] >= 26 |
[Ticket assigned - Date] >= "2023-01-26" The same data type should be used on both sides of the greater than or equal to expression. In this case, it’s a date wrapped in quotation marks. |
Can't use VALUE(Agent replies) as number and 2 as text. Use only numbers or only text. | VALUE(Agent replies)<”2” |
VALUE(Agent replies)<2 The same data type should be used on both sides of the less than expression. A value wrapped in quotation marks is considered text, but a number without quotation marks is a number. Because Agent replies is a metric, the value should be a number, so the quotation marks shouldn’t be used. |
Arithmetical operations and text value joining
Error message | Incorrect formula | Correct formula |
---|---|---|
Can't use [Ticket group] as text and [Ticket ID] as number. Use only numbers or only text. If necessary, use the STRING function to transform numbers to text, or the NUMBER function to transform text to numbers. | [Ticket group]+[Ticket ID] |
[Ticket group]+STRING([Ticket ID]) The goal of this formula is to join text as showcased in Explore recipe: Joining attributes. That’s why the numeric attribute needs to be transformed into text via the STRING function. |
Can't use VALUE(Full resolution time (min)) as number and [Additional task time] as text. Use only numbers or only text. If necessary, use the STRING function to transform numbers to text, or the NUMBER function to transform text to numbers. | VALUE(Full resolution time (min))+[Additional task time] |
VALUE(Full resolution time (min))+NUMBER([Additional task time]) The goal of this formula is to sum up two values. Full resolution time (min) is a number, but Additional task time is a text field with numeric values listed inside of it. The best approach is to create a new numeric custom field in Support for recoding the additional task time, which won’t require any transformation and will work "out of the box" in Explore. Alternatively, the text attribute can be transformed into a number via the NUMBER function. |
Can't use VALUE(First reply time (min)) as number and "60" as text. Use only numbers. | VALUE(First reply time (min))/"60" |
VALUE(First reply time (min))/60 Arithmetic operations such as division require numeric values. A value wrapped in quotation marks is considered text, but a number without quotation marks is a number. The quotation marks shouldn’t be used here. |
Can't use COUNT(Comments) as number and [Comment public] as text. Use only numbers. | COUNT(Comments)-[Comment public] |
COUNT(Comments)-COUNT(Public comments) Arithmetic operations such as subtraction require numeric values. Comment public is a text attribute. You need to use a metric instead. |
Functions
Error message | Incorrect formula | Correct formula |
---|---|---|
Can't use different types in the THEN statement. 1 is number and "0" is text. Use the same type. | IF [Ticket status]="Open" THEN 1 ELSE "0" ENDIF |
The values used after the THEN and ELSE keywords should be of the same type. A value wrapped in quotation marks is considered text, but a number without quotation marks is a number. So there are two ways to fix this error, as shown above. |
Can't use 1 as number and 2 as number. Use only booleans. | IF 1 OR 2 THEN [Ticket ID] ENDIF |
IF VALUE(Agent replies)=1 OR VALUE(Agent replies)=2 THEN [Ticket ID] ENDIF Conditions set inside of the IF statement should be TRUE or FALSE. The correct syntax is: IF TRUE OR FALSE THEN [Ticket ID] ENDIFYou need to add some conditions, as shown above. (However, the formula editor doesn’t assess the validity of the conditions themselves.) |
Can't use number in this function. Use text. | NUMBER([Ticket ID]) |
NUMBER([Ticket external ID]) The NUMBER function is designed to transform text attributes with numeric values into text. The Ticket ID attribute is a numeric field, which is why it can’t be used with this function. However, text attributes such as Ticket external ID can. |
Can't use text, boolean in this function. Use text, text or number. | LINK("https://subdomian.zendesk.com/agent/organizations/"+STRING([Ticket organisation ID]), [Organisation check box]) |
The LINK function expects text as the second parameter, which is why you can’t use a boolean attribute. There are two options, as shown above. You can use a text attribute, or transform the boolean attribute to text via the STRING function. |
Can't use [Ticket created - month] as text here. Use timestamp type. | DATE_LAST([Ticket created - Month]) |
DATE_LAST([Ticket created - Timestamp]) The DATE_LAST function expects a timestamp attribute. |
Can't use different condition types. Use text type. | SWITCH ([Ticket group]) {CASE "Support": "1" CASE 3: "2" } |
SWITCH ([Ticket group]) {CASE "Support": "1" CASE 3: "2" } Because Ticket group is a text attribute, conditions of all cases should be of the text type. A value wrapped in quotation marks is considered text, but a number without quotation marks is a number. So the 3 needs to be wrapped in quotation marks. |
Can't use different types in the SWITCH statement. "1" is text and 2 is number. Use the same type. | SWITCH ([Ticket group]) {CASE "Support": "1" CASE "IT": 2 } |
SWITCH ([Ticket group]) {CASE "Support": "1" CASE "IT": "2" } The results of all cases should be of the same type. A value wrapped in quotation marks is considered text, but a number without quotation marks is a number. So the 2 needs to be wrapped in quotation marks. |
You can't use different types in the array. Use the same type. | IN([Leg instance], ARRAY(1, "2", "3")) |
IN([Leg instance], ARRAY(1, 2, 3)) Use quotation marks for all values if it’s a text attribute, or don’t use quotation marks for all values if it’s a numeric attribute. Leg instance is a numeric attribute, so the formula should not use quotation marks. |
Metric aggregator error messages
Error message | Incorrect formula | Correct formula |
---|---|---|
The VALUE aggregator can't be used with calculated metrics. Use another aggregator or a database-level metric. | VALUE(Sales tickets) / COUNT(Tickets) |
SUM(Sales tickets)/COUNT(Tickets) This formula is meant to calculate the ratio of sales tickets (a calculated metric) to all tickets, but the VALUE aggregator can’t be used with a calculated metric. Because it’s a simple arithmetic operation, the SUM aggregator can be used instead. |
The VALUE aggregator can't be used with calculated metrics. Use another aggregator or a database-level metric. | IF VALUE(First reply time (hrs))>24 THEN "Long reply time" ELSE "Short reply time" ENDIF |
IF VALUE(First reply time (min))>24*60 THEN "Long reply time" ELSE "Short reply time" ENDIF The VALUE aggregator can’t be used with calculated metrics such as First reply time (hrs), but you can achieve the same result by replacing it with a database-level metric such as First reply time (min). |
The VALUE aggregator can't be used with calculated metrics. Use another aggregator or a database-level metric. | IF VALUE(Unsolved tickets age (days))>90 THEN [Ticket ID] ENDIF |
IF DATE_DIFF(NOW(), [Ticket created - Timestamp], "nb_of_hours")>90 THEN [Ticket ID] ENDIF The VALUE aggregator can’t be used with calculated metrics such as Unsolved tickets age (days), which has a formula of: DATE_DIFF(NOW(), [Ticket created - Timestamp], "nb_of_hours"). However, you can use the original formula instead and get a final formula as shown above. |
Can’t use the SUM(database metric) aggregator. Use VALUE aggregator, ATTRIBUTE_FIX or ATTRIBUTE_ADD function. | IF SUM(Requester wait time (min))>120 THEN "Long wait time" ELSE "Short wait time" ENDIF |
IF VALUE(Requester wait time (min))>120 THEN "Long wait time" ELSE "Short wait time" ENDIF This error message appears in calculated attributes, not metrics. In this case, you need to use the VALUE aggregator. |
Can't use COUNT(Solved tickets) in a calculated attribute. Wrap the metric in ATTRIBUTE_FIX or ATTRIBUTE_ADD function. | IF COUNT(Solved tickets)>1 THEN "Solved" ELSE "Unsolved" ENDIF |
IF ([Ticket status - Unsorted] = "Solved" OR [Ticket status - Unsorted] = "Closed") "Solved" ELSE "Unsolved" ENDIF This error message appears in calculated attributes, not metrics. The best way to fix this error is to use the same conditions as the ones used in the Solved tickets metric. The formula of this metric is: IF ([Ticket status - Unsorted] = "Solved" OR [Ticket status - Unsorted] = "Closed") THEN [Ticket ID] ENDIF So you can update the formula as shown above. |
Can't use COUNT(Ticket assignments to Dev) in a calculated attribute. Wrap the metric in ATTRIBUTE_FIX or ATTRIBUTE_ADD function. | IF COUNT(Ticket assignments to Dev)>1 THEN "Solved" ELSE "Unsolved" ENDIF |
IF ATTRIBUTE_FIX(COUNT(Ticket assignments to Dev), [Update ticket ID])>1 THEN "Multiple escalations" ELSE "One or no escalations" ENDIF This error message appears in calculated attributes, not metrics. If the original formula is more complex and can’t be reused, try using the ATTRIBUTE_FIX function to specify on which levels this attribute should be aggregated. In this case, it should be calculated on the Update ticket ID level. |
Other error messages
Error message | Incorrect formula | Correct formula |
---|---|---|
[Ticket statuses] doesn't exist in this dataset. Check if there is a typo. | [Ticket statuses] ="Solved" |
[Ticket status] ="Solved" The most common reasons for this error are:
In this example, there was a typo in the name of the attribute. |
[Calculated group] has a wrongly configured formula. Fix it before saving. | IF [Calculated group] = "light" THEN TRUE ELSE FALSE ENDIF | Calculated group has some misconfiguration in its formula. So you need to fix that first. |
Calculation is referencing itself here COUNT(Sales tickets). Remove or replace it. | COUNT(Sales tickets)/COUNT(Tickets) | You’re adding a formula inside of itself. In this case, the formula being edited is Sales tickets, and the user is trying to add Sales tickets inside of the formula. |
Max of 3 levels in a calculation. Remove the nested calculation here: SUM((2nd reply time) | MED(2nd reply time) / MED(First reply time (min) | The 2nd reply time calculated metric is based on another calculation that is itself based on another calculation. Such calculations are referred to as nested. Only up to 3 nested levels are allowed. |
2 Comments
Hi Eugene Orman,
What does this mean?
At one time, the report had shown some missing calculated attributes / metrics. But then after that, all of the red highlighted calculated attributes disappeared from the report and this error started showing instead.
I am opening a ticket on your behalf so you can share more details via email and we will troubleshoot this error for you.
You will receive an email from our Support Team shortly.
Best,
Please sign in to leave a comment.