Tune in to Trailblazers Innovate for Salesforce product news,
demos, and latest roadmaps. Register here.
Start tracking your progress
Trailhead Home
Trailhead Home

Evaluate Each Record in Reports with Row-Level Formulas

Evaluate Each Record in Reports with Row-Level Formulas

Gabriela Livingston, Ursa Major’s head of sales operations, wants a better handle on the timing of the Ursa Major Solar sales cycle. She’s got some numbers showing that opportunities are taking longer to close on average, but she isn’t sure what that means on a per opportunity basis. She’d like to see data on how many days it’s been taking for each individual opportunity to close. If she can only get that information, she’s confident that she can propose targeted actions to help tighten up the sales cycle.

No problem! Gabriela can get all the information she wants with a row-level formula. Row-level formulas let you evaluate each record in a report and provide record-specific answers.

See Record Level Results with Row-Level Formulas

Let’s show Gabriela how to add a row-level formula to an opportunity report. We’ll set up a row-level formula that calculates the number of days each opportunity takes to close.

  1. Create an opportunity report.
  2. From the Columns section of the Outline pane, click Down arrow | Add Row-Level Formula.
  3. From the Edit Summary-Level Formula Column window, create 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. Set Decimal Points to 0.
    5. In Formula, write:
      • 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.
  4. Click Save & Run.
  5. Name the report Opportunity with Formula.
  6. Click Save.

That’s all there is to it! Now when Gabriela views the Opportunity report, she can scan the Time to Close column (the rightmost column) to see the number of days that each opportunity took to close.