Loading
Analyze Your Data
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Examples: Evaluate Each Record in Reports with Row-Level Formulas

          Examples: Evaluate Each Record in Reports with Row-Level Formulas

          "How many days did it take each opportunity to close? Which case subjects mention the word widget?" Here's how to write row-level formulas that answer these business questions, and others.

          Required Editions

          Available in: Lightning Experience
          Available in: Essentials, Group, Professional, Enterprise, Performance, Unlimited, and Developer Editions
          Available in: Enhanced Folder Sharing
          User Permissions Needed
          To create, edit, and delete formulas in private reports:
          Enhanced Folder Sharing
          Create and Customize Reports
          To create, edit, and delete formulas in public and private reports:
          Enhanced Folder Sharing

          Report Builder OR Report Builder (Lightning Experience)

          To answer common questions like these, assess each record in a report:

          • How many days did it take each opportunity to close?
          • Which case subjects mention the word "widget"?

          The answer to these questions, and many more, are a row-level formula away. Here's how.

          Example: How many days did it take each opportunity to close?

          To answer this question, create an opportunity report and write a row-level formula that subtracts the Created Date from the Closed Date.

          1. Create or edit an opportunities report.
          2. From the Columns section of the Outline pane, click the more actions icon | Add Row-Level Formula.
            Adding a row-level formula
          3. From the Edit Summary-Level Formula Column window, write the formula.
            1. In Column Name, enter Time to Close.
            2. In Description, enter Time to Close in Days.
            3. From Formula Output Type, select Number.

              Even though this formula works with date values, number is the output type needed because the formula performs subtraction and returns a number.

            4. From Decimal Points to 0.
            5. In Formula, write:
              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 >.
              • Because CLOSE_DATE's data type is date and CREATED_DATE's data type is datetime, we convert the value of CREATED_DATE to the date data type with the DATEVALUE() function. The two values must have a matching data type so that we can subtract one from the other. (Datetime and date are different data types because datetime includes information about units of time smaller than a day - hours, minutes, seconds, and so on - and DATE does not.)
            6. To make sure that the formula is error-free, click Validate. If necessary, resolve errors.
            7. Click Apply (5).
            Writing a row-level formula
          4. To save the report, click Save.

          The row-level formula appears as a report column named Time to Close (6). The Time to Close column calculates how many days each opportunity was open by subtracting Created Date from Closed Date.

          A row-level formula in a report

          Example: Which case subjects mention the word "widget"?

          To answer this question, create a cases report and write a row-level formula that evaluates each case subject to see whether it includes the term "widget".

          1. From the Columns section of the OUTLINE pane, click the more actions icon | Add Row-Level Formula.
          2. From the Edit Summary-Level Formula Column window, write the formula.
            1. In Column Name, enter Mentions Widgets?.
            2. In Description, enter Determines whether or a case subject includes the term "widget".
            3. From Formula Output Type, select Text.
            4. In Formula, write:
              IF(CONTAINS(SUBJECT, "widget"), "Yes", "No")
              Note
              Note
              • SUBJECT is the API name of the Subject field. 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 >.
            5. To make sure that the formula is error-free, click Validate. If necessary, resolve errors.
          3. Click Apply.
          4. Click Save.

          The row-level formula appears as a report column named Mentions Widgets?. The Mentions Widgets? column evaluates each case's subject field to determine whether it includes the text widget. If it does, the row-level formula returns Yes. If it doesn't, the row-level formula returns No.

           
          Loading
          Salesforce Help | Article