How to Filter Reports by Compare Field-To-Field in Salesforce

In Salesforce, sometimes we want to compare one field value with another field; with the name of compare, you must want to know the difference between them and display a particular result after comparison.

Compare field-to-field value filter only works in Salesforce Lightning.

In this Salesforce tutorial, we are going to learn about field comparison with field-to-field filters, what is meant by comparing field values, and what are the uses of comparing two fields. Additionally, we will see how to filter reports by comparing field-to-field in Salesforce Lightning.

Compare Fields Value in Salesforce

What is meant by comparing field values in the Salesforce Report?

In Salesforce now it is possible to compare field-to-field filter values in different fields available in Salesforce Report. By using a conditional operator, we can compare fields and display results as per our requirements.

What are the uses of comparing two fields in the Salesforce Report?

Following are the uses of comparing two fields –

  • Using comparison helps the user to get the result of which condition he applied.
  • We can easily differentiate fields and choose the result that we want by using comparison.
  • This enables the user to narrow down our data and makes it more straightforward to analyze data. It makes our task easier.

Points to be remembered

  • Compare field-to-field value filter only works in Salesforce Lightning.
  • This only works in these datatypes fields – Number, Currency, Date, and DateTime.
  • In a single report, you can have up to four field-to-field value filters.
  • You can compare only the same data type fields with each other.
See also  How To Group Report By Year In Salesforce

Example

Suppose in the Account Object, we have two fields: Last year’s revenue and This year’s revenue. In the report, you need to display only those reports that This year’s revenue should be greater than Last year’s revenue.

We can do this using a conditional operator. In the next section, we will see how we can implement this example.

How to Filter Reports by Comparing Fields-To-Fields in Salesforce Lightning

Using the above example, we will see how to add filters to reports by comparing field-to-field in Salesforce.

1. Go to the Home page, click on the Home tab, and then you will see the App Launcher option. Click on App Launcher.

In the search box Search the Report, and click on Report option.

Create Report to compare fields in Salesforce

2. To create the new report, there is a button in the right corner; click on the New Report button.

Create New Report to compare fields in Salesforce

3. Now, you need to select the Object to create the report. To select the object, you will see the Category option on the left side of the screen. You need to click the All option, and you can select Account Object directly or search for the object.

Then click on the Start Report button.

Compare fields Filter Report in Salesforce

4. Here, you can see, without any comparison before applying the filter, both fields displayed with values as we discussed in the above example. We will apply the greater-than-conditional operator to these fields.

How to compare fields in Salesforce report

5. To apply the condition to the report, click on the Filter option.

  • Field: As I explained, we can select only three types of fields to compare the values. Here, I have selected This Year’s Revenue, which is the currency field.
  • Operator: In the Operator option, we need to add conditions as per our requirement. Here, I have selected Greater than Operator.
  • Type: In the Type field, you have two options –
    • Value: In this option, you can directly enter any particular value that you want to compare with.
    • Field: In this option, firstly, any other field that is related to the field you want to compare with will populate. You can change it by clicking the lookup icon.
  • Here, in the Type field, I have selected the Last Year Revenue field.
  • Then click on the Apply button.
Apply filter to compare fields in Salesforce report

6. The condition that we applied was This Year Revenue > Last Year Revenue. Now, the records displayed are those that match the applied condition.

How to apply filter to compare fields in Salesforce report

This is how can filter reports by comparing fields-to-fields in Salesforce Lightning.

See also  How to Create an Average Deal Report in Salesforce

Conclusion

I hope you have got an idea about field comparison with field-to-field filters, what is meant by comparing field values, what are the uses of comparing two fields, and what points should be remembered.

Additionally, we have seen how to filter reports by comparing fields-to-fields in Salesforce Lightning.

You may like to read: