Smart Systems for Home

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

Add Filter Logic in Salesforce: Step-by-Step Guide

· 7 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 Salesforce, edit the report (or list view / dashboard source report that feeds it), click the Filters panel, add each filter condition you need, then open the Filter Logic dropdown and replace the default ANDs with your own expression such as 1 AND (2 OR 3). Filter logic only appears once a report has at least two filter conditions, and the numbers in your expression refer to the order the filters are listed, not to their names. This guide walks through that process for Reports and List Views, plus the syntax rules that trip most people up.

What You'll Need

  • A Salesforce account with permission to create or edit reports in the folder you are working in (or "Manage List Views" permission for list views).
  • A report or list view based on a report type that already returns data — filter logic cannot fix a report type that lacks the fields you want to filter on.
  • At least two filter conditions in the Filters panel. With a single condition there is nothing to combine, so the logic option stays hidden or irrelevant.
  • A clear idea of the question you are answering, written as a sentence. "Open opportunities over 50k owned by my team in this quarter" translates cleanly into logic; "interesting deals" does not.

Step-by-Step

  1. Open the report in edit mode. Go to the Reports tab, open the report, and click Edit so you are in the report builder rather than the read-only view. Labels differ slightly between Salesforce Classic and Lightning Experience and between releases, but the Filters panel is always on the left in Lightning.
  2. Add your filter rows first. In the Filters panel, click Add Filter and choose a field, an operator, and a value for each condition. Work top to bottom in the order you want them numbered, because row 1 is filter 1, row 2 is filter 2, and so on. Reordering rows later changes what your expression means.
  3. Decide what the default already does. By default, Salesforce combines every filter with AND, meaning a record must satisfy all of them. Write down which conditions are truly mandatory (those stay joined with AND) and which are alternatives (those should be joined with OR).
  4. Open the Filter Logic control. Below the filter list, click the Filter Logic dropdown and choose Custom Logic. A text box appears pre-filled with an expression that mirrors the current filters, typically 1 AND 2 AND 3. That pre-filled text is your safety net — it shows the exact numbering Salesforce expects.
  5. Rewrite the expression. Use only numbers, the words AND, OR and NOT, and parentheses. For example, to return records that match filter 1 and either filter 2 or filter 3, type 1 AND (2 OR 3). To return records that match filter 1 but not filter 2, type 1 AND NOT 2. Do not type field names, operators like > or =, or quote marks — the values already live in the filter rows.
  6. Keep every filter referenced or deliberately excluded. A filter that does not appear in the expression is ignored entirely, which is a common cause of unexpectedly large results. If you want filter 3 active, its number must be in the logic.
  7. Balance your parentheses. Each opening bracket needs a closing one and the groups must not cross. When in doubt, build the expression from the inside out: (2 OR 3) first, then wrap it with the mandatory conditions.
  8. Run the report. Click Run (or Save & Run). Check the row count and open a couple of records to confirm they satisfy the rule you intended. If the count is zero or far too high, the logic — not the data — is usually the culprit.
  9. Save with a clear name. Save the report, and if it feeds a dashboard, note that the component recalculates on the report's refresh schedule rather than instantly. For list views, the same Filter Logic option sits under the list view's filter panel while editing the view; save the view to apply it for everyone who shares it.

Common Mistakes

Forgetting that AND binds before OR. Salesforce evaluates AND before OR, much like arithmetic. 1 OR 2 AND 3 means "1, or (2 and 3)", not "(1 or 2) and 3". Add parentheses whenever you mean something else.

Renumbering without thinking. Deleting a filter row shifts the numbers of everything below it, silently changing what your expression returns. After deleting a row, reopen the logic box and check each number still points at the filter you meant.

Using field names or values inside the logic box. Filter logic contains only numbered references. Writing Stage = 'Closed Won' in the box is invalid; put that condition in a filter row and reference its number.

Assuming filter logic applies to cross filters or row-level formulas. Filter logic combines filter rows only. Cross-filter and row-limit settings behave separately and need their own attention.

Expecting it to work with one filter. With a single row there is nothing to combine, so custom logic is either unavailable or meaningless.

Tips

  • Build the simplest possible version first, verify the row count, then add complexity one clause at a time so you always know which change broke it.
  • Use NOT sparingly and test it: NOT 2 can behave unexpectedly when the filtered field is blank on some records, because blanks often do not count as matching or not matching in the way people assume.
  • Keep a plain-English comment in the report description, such as "Excludes records where Region is blank", so the next person can decode the logic quickly.
  • If a teammate shares a report with identical logic, copy it rather than rebuilding — the filter rows and expression come along.
  • Test with a known record. Find one record you are certain should appear, and one you are certain should not, then check both against the result.

Troubleshooting

The report returns the same rows as before. You may have edited the logic but not saved, or the logic references filters that do not actually narrow anything. Reopen the logic box and confirm each number maps to a filter that excludes something.

An error appears when you run the report. Read the message literally — it usually points at a stray character, a missing parenthesis, or a number that does not exist. Remove all spaces inside numbers, delete any text that is not a number, AND, OR, NOT or a bracket, and try again.

You get zero results. Temporarily replace your logic with 1 AND 2 to confirm both filters individually return data; if one returns nothing on its own, the problem is the filter value (a picklist label that changed, a date range in the past), not the logic.

The results look right in the report but wrong on a dashboard. Dashboard components can carry their own filters on top of the source report. Open the component's settings and check whether an extra filter is narrowing the results further.

Nothing you try works. Revert to the pre-filled expression Salesforce offered when you chose Custom Logic, save, and rebuild from there. If a report type seems to be missing fields entirely, that is a report type limitation, not filter logic — ask your admin whether a different report type or a joined report is needed.

Frequently Asked Questions

Where is Filter Logic in Salesforce?

In Lightning Experience report builder it sits just below the Filters panel, as a dropdown you switch from the default to Custom Logic. In list views it appears in the same filter area while editing the view. Exact wording varies slightly by version and region.

Can filter logic use field names instead of numbers?

No. It uses only the row numbers of your filters plus AND, OR, NOT and parentheses. Conditions and their values stay in the filter rows.

What is the difference between AND and OR?

AND requires every condition to be true; OR requires at least one. Combining them with parentheses lets you mix mandatory and alternative conditions in one report.

Why did my filter logic disappear after I deleted a filter?

Deleting a row renumbers the filters below it, so the expression may no longer reference the filters you intended, and Salesforce may strip logic it can no longer resolve. Reopen the logic box and rewrite it.

Does filter logic work on dashboards?

Indirectly. Dashboards display source reports, so the logic applies through the report. Dashboard components can also apply their own filters, so check both places if numbers disagree.

Can I use filter logic on cross filters?

Filter logic combines standard filter rows. Cross filters are configured separately, so treat them as their own setting rather than part of the numbered expression.