Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How to Add Filter Logic in Salesforce Reports

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To add filter logic in a Salesforce report, open the report in edit mode, add the filters you need in the Filters panel, then click the filter logic icon (or the Filter Logic link) and combine the filter numbers with AND, OR, and parentheses. For example, 1 AND (2 OR 3) returns records that match filter 1 plus either filter 2 or filter 3. Filter logic is available in the report builder on desktop; the mobile app is mainly for viewing reports, so build and edit the logic in a browser.

What You'll Need

  • A Salesforce user account with permission to create or edit reports (typically the "Create and Customize Reports" permission).
  • Access to the report you want to change, or permission to create a new one.
  • At least two standard or custom filters on the report. Filter logic only matters when there is more than one filter to combine.
  • A desktop browser. The full report builder with filter logic is not available in the Salesforce mobile app.

Step-by-Step

  1. Open the report. Go to the Reports tab, find the report, and open it. If you are creating a new report, choose the report type and click Create.
  2. Enter edit mode. Click Edit (or the pencil icon) so the report builder opens with the Filters panel on the left. If you only see a Run Report button, you may not have edit permission on that report.
  3. Add your filters first. In the Filters panel, click Add Filter and choose fields such as Opportunity Stage, Close Date, Owner, or Amount. Set each filter's operator and value. Salesforce numbers the filters 1, 2, 3, and so on in the order they appear. You need at least two filters before logic changes anything.
  4. Open the filter logic editor. In the Filters panel, click the filter logic icon or the Filter Logic link. The exact label and position can differ slightly by Salesforce version and by whether you are using Lightning Experience or Classic, but it appears near the top of the Filters panel. A small text box opens showing the default logic, usually 1 AND 2 AND 3.
  5. Write the logic using filter numbers and operators. Use the numbers assigned to your filters, the operators AND, OR, and NOT, and parentheses to group conditions. For example:
    • 1 AND 2 — records must match both filters.
    • 1 OR 2 — records can match either filter.
    • 1 AND (2 OR 3) — records must match filter 1 and at least one of filters 2 or 3.
    • NOT 1 — records that do not match filter 1.
  6. Check your parentheses. Every opening parenthesis needs a closing one, and each filter number should appear exactly once. If you reference a filter number that does not exist, Salesforce shows an error and will not save the logic.
  7. Apply and validate. Click Apply or OK to close the logic editor. Salesforce validates the syntax and shows a message if something is wrong. Fix any errors before continuing.
  8. Run the report and check the results. Click Run (or Save & Run). Compare the row count and a few sample records against what you expect. If the results look wrong, go back to the filter logic editor and test a simpler expression first, such as 1 AND 2, then add complexity.
  9. Save the report. Click Save (or Save As to keep the original unchanged). Give it a clear name and choose the folder where it should live so others can find it.

Common Mistakes

  • Forgetting that filter numbers follow the order in the panel. If you reorder filters, the numbers can change and your logic may no longer mean what you intended. Recheck the logic after reordering.
  • Assuming AND and OR are evaluated left to right. They are not; use parentheses to make the grouping explicit. 1 AND 2 OR 3 is not the same as 1 AND (2 OR 3).
  • Using filter logic when a simple filter would do. If you only need records that match all conditions, the default AND behavior is enough and easier to maintain.
  • Leaving a filter in the panel that is not referenced in the logic. Unreferenced filters are ignored, which can confuse anyone reading the report later.
  • Expecting filter logic to work in the mobile app. Build and edit it in a desktop browser; the mobile app is for viewing.

Tips

  • Keep logic as short as possible. If you need many OR conditions on the same field, consider a single filter with multiple values instead of several filters joined with OR.
  • Test with a small date range first so the report runs quickly while you are experimenting.
  • Add a short description to the report explaining the logic in plain language, so colleagues know what the numbers mean.
  • Use Save As to create a copy before making big logic changes, so you can compare results side by side.
  • If the report is used in a dashboard, re-run the dashboard component after saving to confirm the new logic is reflected.

Troubleshooting

  • The filter logic box will not accept my expression. Check for a missing parenthesis, a filter number that does not exist, or a lowercase operator. Use uppercase AND, OR, and NOT.
  • The report returns no rows. Temporarily remove the logic and run the report with the default AND to see whether the filters themselves are too restrictive. Then reintroduce the logic one condition at a time.
  • The report returns too many rows. An OR may be broader than you intended. Replace it with AND, or group conditions with parentheses so the OR applies only where needed.
  • The logic option is missing. Confirm you are in the report builder in a desktop browser and that you have edit permission on the report. If you can only view the report, ask its owner or an administrator for edit access.
  • Results changed after someone edited the report. Open the filter logic editor and check that the numbers still match the filters in the panel; filters may have been added, removed, or reordered.

Frequently Asked Questions

Can I use filter logic with more than three filters?

Yes. Each filter gets a number, and you can combine as many as the report allows. Keep the expression readable with parentheses and test it after each change.

Does filter logic work in Salesforce Classic?

Yes, filter logic is available in the report builder in both Lightning Experience and Classic, though the button labels and layout differ slightly.

What happens if I reference a filter number I deleted?

Salesforce flags the expression as invalid and will not let you apply it until you remove or replace the missing number.

Can I save a report with invalid filter logic?

No. The logic must validate before the report can be saved. Fix the syntax error first.

Is filter logic the same as a cross filter?

No. Filter logic combines filters on the same report. Cross filters filter on related records through a relationship, and the two can be used together.

Can I edit filter logic on my phone?

The Salesforce mobile app is designed for viewing reports. Use a desktop browser to edit filters and logic.