Salesforce Lightning reports allow users to combine multiple filters with advanced logic using AND, OR operators and parentheses. This guide walks through adding filter logic to refine report data.
What is Filter Logic?
Filter logic enables you to create complex conditions by linking multiple report filters with logical operators. For example, you can show records where (Field A equals X AND Field B equals Y) OR Field C equals Z.
Step-by-Step Guide
-
Open a Report in Lightning Navigate to the Reports tab and open an existing report or create a new one.
-
Enter Report Builder Click "Edit" on the report to enter the Report Builder interface.
-
Access Filter Options In the Filters panel, add the necessary filters (e.g., fields and values).
-
Add Filter Logic Click "Advanced Filter Logic" to open the text box where you can input your logic string.
-
Write AND, OR & Parentheses Use numbers corresponding to your filter order (e.g., 1, 2, 3) and combine them with operators:
1 AND 2means both filter 1 and filter 2 must be true.1 OR 2means either filter 1 or filter 2 must be true.- Parentheses group conditions:
(1 OR 2) AND 3
-
Apply & Test Logic Click "Apply" and preview the results. Adjust if records don't match expectations.
-
Save the Report Once satisfied, save the report for future use.
Tips
- Always verify filter numbers match the order in the Filters panel.
- Use parentheses to control evaluation order, just like in math.
- Test with small datasets to ensure logic works as intended.
Mastering filter logic helps you create precise reports tailored to your business needs.