How to Use IF Filter in Salesforce Report

In Salesforce, we cannot use the IF statements directly, or we cannot use the IF filter instead of the if statement. We have AND OR statements for the applied conditions in the Salesforce filter report.

In this Salesforce tutorial, we are going to learn about the IF Filter in Salesforce Report, what is IF filter in Salesforce, when we can use it, and what are the uses of it. Additionally, we will see step-by-step how to use the IF filter in Salesforce Lightning and Salesforce Classic.

IF Filter in Salesforce Report

What is the IF filter in the Salesforce report?

In Salesforce, we cannot use IF statements directly when we have such scenarios and need to use IF statements. Then, we can use AND OR filter logic for applying the conditions in the Salesforce report.

When can we use the IF statement in Salesforce?

When we have two or more than two conditions for applying to report at that time we can use these conditions as AND, OR form, using the following scenarios we can understand when we can use the IF statement.

What are the uses of the IF filter in the Salesforce Report?

The following are the uses of the IF filter –

  • IF filter is very useful when we want to add more than two filter criteria and conditions.
  • Using the IF filter, we can manage or decide which data we want to show in reports.
  • We can apply conditions as per our needs and requirements.
  • This enables the user to narrow down our data and makes it more straightforward to analyze data. It makes our task easier.
See also  How to add Dashboard to Home page in Salesforce

How to Use IF Filter in Salesforce Lightning Report

Scenario

Example 1: On the Account object, if you want to set IF (Type – Customer – Direct and Rating – Hot or Industry – Apparel).

That means IF Type = Customer – Direct, then in the Rating and Industry field, any of them, either rating or industry, should display a specified value.

Using the above example, we will see how to use the IF filter in Salesforce Report.

1. Go to “App Launcher” -> Search “Reports” -> Click on Reports.

Create IF filter report in Salesforce

2. To create a new Report, click on the New Report button.

Add IF filter report in Salesforce Lightning

3. Go to All category -> to select a Report Type, Search “Accounts“, you can search on which object you want to create a report. -> Select Accounts.

Apply IF filter report in Salesforce

4. Now, we need to add filters with the specified values. To add the filter, click on the Filter option -> then select Fields one by one; here, you can see I have added three fields that I have specified in the example.

5. After applying the filter, you can see only those records displayed which match the accurate condition. We need IF (Type = Customer – Direct) and (Rating or Industry). One value of them should be the specified value.

IF filter report in Salesforce Lightning

6. To achieve that condition, we need to Add Filter Logic. For that, click on the dropdown arrow. -> Then click on the Add Filter Logic option.

Add IF filter report in Salesforce

7. Then, you need to enter Logic for the condition.

  1. Type = Customer-Direct.
  2. Rating = Hot. OR 3. Industry = Apparel.
See also  How to create a report for weekly created opportunities in Salesforce?

Here, we can write logic IF 1 AND (2 OR 3). -> Then click on the Apply button.

Apply IF filter report in Salesforce Lightning

8. Now you can see in the Type column only the Customer-Direct value is displayed.

And because of the OR condition in the Rating field Hot and cold value is also displayed. Same as the Industry column other than the Apparel value is displayed.

Create new IF filter report in Salesforce Lightning

This is how we can add an IF filter statement in the Salesforce Lightning report.

How to Use IF Filter in Salesforce Classic Report

Let’s consider a scenario, we will see how to apply this scenario in implementing steps.

Example: On the Lead object, we want to set IF Lead Status – Working – Contacted and Rating – Hot, but we don’t want that Company – TNR Corp.

Using the above example, we will see how to use the IF filter in Salesforce Report.

1. Go to All Tabs -> You will see the “Reports” tab -> Click on the Reports tab.

IF Report Filter in Salesforce Classic

2. Then click on the “New Reports” button to create a new report.

Create IF Filter Report in Salesforce Classic

3. Select the Object; here, I have selected “Leads” Object -> Click on the Create button.

IF Filter report in Salesforce Classic

4. Now we want to add a filter for Lead status = Working – Contacted and Rating = Hot. After adding these two filters, you can see the result. But as per our example, we don’t want the company name as TNR Corp.

You can read the whole article on: How to Apply Filter in Salesforce Report

Create new IF filter report in Salesforce Classic

5. To remove the TNR Corp. company, we need to apply another filter, but in this, we need to select Operator as not equal to. The company is not equal toTNR Corp.

See also  How to Pass a Record ID into Salesforce Flow

After applying all three conditions, we can see the company name with TNR Corp. will be removed from the report.

Hence our logic formula will be 1 AND 2 AND 3.

Apply IF filter report in Salesforce Classic

This is how we can add an IF filter statement in the Salesforce Classic report.

Conclusion

I hope in this Salesforce article, you have got an idea about the IF filter in the Salesforce report, in that we have learned about what the IF filter statement is, when we can use it, and what are the uses of the IF filter.

Additionally, we have seen step-by-step examples of how to apply the IF filter in Salesforce Lightning and Salesforce Classic reports.

You may like to read: