In Explore, you can write formulas that power custom metrics and attributes. It's important to construct formulas properly to ensure they work. If a formula isn’t correct, the formula editor displays an error message in real time. The error message identifies the issue and provides guidance on how to resolve it.

This article explains how to fix a misconfigured formula in your reports. It lists the error messages in the formula editor and provides advice to fix your formula, including examples of incorrect and correct formulas.

Note: Effective August 13, 2024, reports with misconfigured formulas that may have worked previously stop working. An error message displays instead.

This article contains the following topics:

  • Fixing misconfigured formulas
  • Types of error messages in the formula editor

Related articles:

  • Formula writing resources
  • Explore functions reference

Fixing misconfigured formulas

If a calculated metric or attribute contains a misconfigured formula, it doesn’t return results. Identify misconfigured formulas by checking these places:

  • Reports library: Reports that use a misconfigured formula appear in the Updates required category in the Reports library
  • Dashboards library: Dashboards that use affected reports appear in the Updates required tab in the Dashboards library
  • Report builder: A warning message appears at the bottom of a report that uses the formula
  • Formula editor: A warning message appears in the formula editor for the affected formula

To fix a misconfigured formula, open a report that uses it and correct it in the formula editor. Then republish any dashboards that use the report.

Note: If a misconfigured formula is nested inside of a non-formula-based calculation, such as a date range metric, a group, or a set attribute, no error message appears in the non-formula-based calculation. To see the error message in the formula editor, open the original nested calculation.
Tip: Ask report creators to fix their formulas. The Created by column in the Reports library shows which user created each report. If you don’t see Created by, add it by clicking the columns icon () and selecting Created by.

To update a misconfigured formula

  1. In Explore, click the Reports icon () to open the Reports library.
  2. Click the Updates required tab.

  3. Click one of the listed reports to open it.
  4. For each calculated metric or attribute:
    • Click the metric or attribute and then click the pencil icon.
    • Check the formula to identify any misconfigurations. The misconfigured parts of the formula are underlined. An error message tells you what needs to be corrected.

    • (Optional) Create a copy of the metric or attribute before making any changes. This prevents impact on existing reports during troubleshooting.
    • Fix the issues with the formula specified by the error message. See the sections below for additional guidance with specific error messages.

      Fixing a calculated metric or attribute’s formula in one report also fixes it in any other report it’s used in.

    • (Optional) If you created a copy of the metric or attribute, update the original.
  5. Save the report

To republish affected dashboards

  1. Click the Dashboards icon () to open the Dashboards library
  2. Click the Updates required tab
  3. Hover your mouse over one of the dashboards and click Edit
  4. In the dashboard, click the drop-down arrow next to Share and select Publish. The next time users look at the shared dashboard, they’ll see the latest version
  5. Click Publish

Types of error messages in the formula editor

This section lists these types of error messages and provides advice on resolving them:

  • Most common formula errors
  • General syntax error messages
  • Data type error messages
  • Metric aggregator error messages
  • Other error messages

Most common formula errors

See the sections below for additional guidance on specific error messages.

General syntax error messages

If you see the following error message, it means the syntax in your formula is incorrect:

  • "There’s an issue with the formula. Check your calculation syntax and try again."

The table below lists the most common reasons for this error.

Reason Incorrect formula Correct formula
You opened but didn’t close a bracket or parenthesis, or 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 in the formula editor, including incorrect and correct versions of a formula.

The sections below cover data type error messages:

  • Equal, not equal, and less than or greater than expressions
  • Arithmetical operations and text value joining
  • Functions

Equal, not equal, and less than or greater than expressions

Error message example 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"

Use the same data type on both sides of the equality expression. A value wrapped in quotation marks is 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]

Use the same data type 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"

Use the same data type 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

Use the same data type on both sides of the less than expression. A value wrapped in quotation marks is text, but a number without quotation marks is a number. Because Agent replies is a metric, the value should be a number, so do not use quotation marks.

Arithmetical operations and text value joining

Error message example 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])

This formula joins text as showcased in Explore recipe: Joining attributes. Transform the numeric attribute 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])

This formula sums two values. Full resolution time (min) is a number, but Additional task time is a text field with numeric values inside. The best approach is to create a new numeric custom field in Support for recording additional task time, which works without transformation in Explore. Alternatively, transform the text attribute 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 like division require numeric values. A value in quotation marks is text, but a number without quotation marks is a number. Do not use quotation marks 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 like subtraction require numeric values. Comment public is a text attribute. Use a metric instead.

Functions

Error message example 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

IF [Ticket status] = "Open" THEN 1 ELSE 0 ENDIF

or

IF [Ticket status] = "Open" THEN "1" ELSE "0" ENDIF

Values after THEN and ELSE keywords should be the same type. Quotation marks indicate text, while their absence indicates a number. Fix this error using one of the two ways 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 inside the IF statement should be TRUE or FALSE. The correct syntax is: IF TRUE OR FALSE THEN [Ticket ID] ENDIF. Add conditions instead. 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 transforms text attributes with numeric values into text. The Ticket ID attribute is a numeric field and cannot be used with this function. Text attributes like Ticket external ID can.

Can't use text, boolean in this function. Use text, text or number LINK("https://subdomain.zendesk.com/agent/organizations/" + STRING([Ticket organization ID]), [Organization check box])

LINK("https://yoursubdomain.zendesk.com/agent/organizations/" + STRING([Ticket organization ID]), [Ticket organization name])

or

LINK("https://yoursubdomain.zendesk.com/agent/organizations/" + STRING([Ticket organization ID]), STRING([Organization check box]))

The LINK function expects text as the second parameter. Do not use a boolean attribute. Use a text attribute or transform the boolean attribute 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, all case conditions should be text type. Wrap the number 3 in quotation marks to make it text.

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 the same type. Wrap the number 2 in quotation marks to make it text.

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 do not use them if it’s a numeric attribute. Leg instance is numeric, so do not use quotation marks.

Invalid time unit for the given dates DATE_DIFF([Ticket solved - Date], [Ticket created - Date], "minutes") When using the DATE_DIFF function, ensure the time unit (third parameter) matches the date fields' precision. For dates without time details (hours, minutes), only "year", "month", or "day" are allowed. Using unsupported units like "minutes" will trigger an error.

Metric aggregator error messages

Error message example Incorrect formula Correct formula
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. Use the VALUE aggregator here.

Can't use COUNT(Solved tickets) aggregator. Use VALUE aggregator, or wrap the metrics 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") THEN "Solved" ELSE "Unsolved" ENDIF

This error message appears in calculated attributes. Fix this by using the same conditions as the Solved tickets metric.

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. If the original formula is complex, use the ATTRIBUTE_FIX function to specify aggregation levels. Calculate this on the Update ticket ID level.

Time in status already contains aggregators. Either replace AVG with SUM, or ensure that Time in status contains only VALUE aggregators. AVG(Time in status)

SUM(Time in status)

Time in status is a nested metric with an existing aggregator. Calculating an average on top of a median is not allowed. Set the top-level aggregator to SUM or change the lower-level aggregator to VALUE.

Other error messages

Error message example Incorrect formula Correct formula
[Ticket statuses] doesn't exist in this dataset. Check if there is a typo. [Ticket statuses] ="Solved"

[Ticket status] ="Solved"

Common reasons for this error include:

  • The attribute or metric is from another dataset
  • Typo in the name
  • Name is not in the user’s profile language
  • Formula references a calculation with quotation marks in the name. Remove them to resolve the error
[Calculated group] has a wrongly configured formula. Fix it before saving. IF [Calculated group] = "light" THEN TRUE ELSE FALSE ENDIF Calculated group has a misconfiguration. Fix that first.
Calculation is referencing itself here COUNT(Sales tickets). Remove or replace it. COUNT(Sales tickets)/COUNT(Tickets) Do not add a formula inside of itself. In this case, the user is editing Sales tickets and trying to include it in 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 metric is nested. Only up to 3 nested levels are allowed.
Can't use [Ticket Group] here. INCLUDES_ALL can only be used on tag attributes. INCLUDES_ALL([Ticket Group], "Support", "Sales")
  • INCLUDES_ALL([Ticket Tags], "support", "sales")
  • IN([Ticket Group], ARRAY( "Support", "Sales"))

INCLUDES functions work only with tag attributes. Use the IN function for other attributes.

[Date range calculated metric] has a wrongly configured formula. Fix it before saving. COUNT([Date range calculated metric]) Date range calculated metrics are not supported in calculated metrics. Use a result metric calculation instead.
You can't use [function] here. Use INCLUDES_ALL or INCLUDES_ANY for tag attributes. IF (CONTAINS([Ticket tags],"sales")) THEN "Sales" ELSE "Prod" ENDIF

INCLUDES_ALL([Ticket tags], "Sales", "Prod")

Only INCLUDES_ALL and INCLUDES_ANY report on tags.

Powered by Zendesk