Evaluate Each Record in Reports with Row-Level Formulas (Beta)

Answering business questions sometimes means making a calculation on every row in a report. With row-level formulas, you don't need to export report data to a spreadsheet or ask an admin to create a one-off custom formula field. Instead, write a row-level formula directly in the Lightning report builder.

Where: This change applies to Lightning Experience in Group, Essentials, Professional, Enterprise, Performance, Unlimited, and Developer editions.

Note

Note

As a beta feature, row-level formulas is a preview and isn’t part of the “Services” under your master subscription agreement with Salesforce. Use this feature at your sole discretion, and make your purchase decisions only on the basis of generally available products and features. Salesforce doesn’t guarantee general availability of this feature within any particular time frame or at all, and we can discontinue it at any time. This feature is for evaluation purposes only, not for production use. It’s offered as is and isn’t supported, and Salesforce has no liability for any harm or damage arising out of or about it. All restrictions, Salesforce reservation of rights, obligations concerning the Services, and terms for related Non-Salesforce Applications and Content apply equally to your use of this feature. You can provide feedback and suggestions for row-level formulas in Lightning Experience in the Trailblazer Community.

Why: For example, write a row-level formula on an opportunity report to calculate the number of days between each opportunity's created date and close date. To do so, subtract the created date from the close date.

Add a row-level formula from the Columns section of the Overview pane by clicking More actions | Add Row-Level Formula (Beta) (1).

Adding a row-level formula

Name the row-level formula column Time to Close (2). Choose Number as the Formula Output Type (3). Then write the formula (4):

CLOSE_DATE - DATEVALUE(CREATED_DATE)
Note

Note

  • CLOSE_DATE and CREATED_DATE are the API names of the Close Date and Created Date fields. Formulas work with the API names of fields, not the display names. The easiest way to enter the API name of a field is to search for it from the fields menu, select it, and click Insert >.
  • The two fields' values must have a matching data type so that we can subtract one from the other. Because CLOSE_DATE's data type is date and CREATED_DATE's data type is datetime, we use the DATEVALUE() function to convert CREATED_DATE to a date.

Click Apply (5).

Writing a row-level formula

The row-level formula appears as a column on the report (6).

A row-level formula in a report

How: Enable the row-level formulas beta feature from Setup. Enter Reports in the Quick Find box, then click Reports and Dashboards Settings. Select Enable Row-Level Formulas (Lightning Experience Only) and click Save.