A Report is a list of records that meet the standard and criteria we define. But calling it a simple list is not good enough, and you’ll find out why in a couple of minutes. But, before we dive deep into this topic, let’s acquaint ourselves with a couple of concepts.
A Report Type, as we know, determines which records and fields are available for use when creating a record. The Report Type is pretty much a template that makes reporting easier. For now, we’ll be working on some of the standard report types available, out of the box, on the platform. To create a custom report, go to Setup, and then type Report Types in the Quick Find Box, and thereafter select Report Types.
You can’t edit standard report types.
Before we move forward, we need to get comfortable with another concept: How report types are structured.
- Every report type on Salesforce has a primary object relationship and a field layout.
- Each object relationship specifies a primary object and, optionally, one or more related objects.
- We can only have up to four related objects.
- Objects can be standard or custom Salesforce entities.
- If your report type has only a primary object, it includes only the records of that Object.
- If your report type specifies a related object, then your report type includes the primary object along with or without (depending on configuration) the related objects.
- In case you define a related object, you have two options when it comes to configuring the report type’s object relationship:
- Primary object with the related object
Records returned in these reports include only those primary objects with at least one related object record.
- Primary object with or without the related object
Records returned in these reports include all primary objects, with or without the related object record.
- Primary object with the related object
How to Create Reports with the Report Builder in Lightning Experience
Now that we know the basics, let’s get hands-on and create a report. To create a new report, we’ll have to open the Report Builder.
To access the Report Builder, open the Reports tab and click New Report.
Let’s start with the basics. Follow these steps to create a report that displays all Opportunities:
1. Open the Reports tab, then click New Report to open the Report Builder.
2. Select Opportunities for Report Type, then click Start Report.
3. From the Filters tab in the sidebar, click Close Date and select the following:
Date: Created Date
Range: All Time
4. Click Apply.
5. Now select Save & Run from the Navigation bar.
6. For Report Name, enter All Opportunities.
7. Click Save.
And voila! We created a Report! It’s as simple as that, but to harness the full potential of this tool, we have to take it a step further. Let’s start by adding Filters to our Report.
How to Add Filters
We’ll be working on the same Report we just created, so if you haven’t completed that exercise, go back and finish it before proceeding.
Why use Filters? → Filters and filter logic can be used to answer questions about your data. They allow you to get more specific and filter your data to meet the conditions you’ve placed on it. We have access to a couple of filter types. Let’s take a look at that now.
Now that we’ve got that down let’s add a filter to the report, All Opportunities, we created in the last section. We want a report of all opportunities that are closed and won.
1. Open Reports via the Reports tab, click on the dropdown menu( ) arrow next to All Opportunities, and click Edit.
2. Select Filters from the sidebar, then click Add Filter.
3. Select the field Stage from the dropdown menu.
4. Fill in the following:
Value: Closed Won
5. Click Apply.
6. We don’t want all these fields in our filter to display just the required fields, select Outline from the sidebar.
7. Click on the x symbol ( ) next to the fields we want to remove. We want the following fields in the report: Account Name, Opportunity Name, Stage, Lead Source, and Type. Remove the rest of the fields from the Columns list.
8. Click Save.
We want to change the name of the report to keep things accurate and up-to-date in our org.
9. Click on the pencil icon ( )next to the report name, All Opportunities, and enter the following: Closed Won Opportunities.
10. Click on Run to view the report!
Well, look at that, wasn’t that a fun exercise?! It’s that simple to add filters to your report!
How to Use Cross-Object Filters
Want to level up? Let’s use a Cross-Object Filter. We can apply this when we want to filter a report by the child object using the WITH or WITHOUT conditions.
We want to display a report that includes all Contacts with Activities.
1. Open Reports from the navigation bar, and click New Report.
2. For Report Type, choose Contacts and Accounts, then click Start Report.
3. From the sidebar, select Filters.
4. For the Created Date filter, select All Time for Range, then click Apply.
5. Click on the more action arrow ( ) next to Filters and select Add Cross Filter.
6. Select the following:
- Select the parent object from the Show me dropdown list. Select Contacts.
- Choose with as the operator.
- Select the child object from the Secondary Object dropdown list. Select Activities.
7. Click Apply.
8. Click Save on the navigation bar.
9. Name the report as Contacts with Activities, then click Save!
NOTE: We have the option to add sub-filters if we wish to. Simply click on Add Activities Filter under Cross Filters to do that.
How to Use Filter Logic
Filter logic allows us to apply filters based on Boolean conditions. These are the operators available for applying filter logic:
Let’s take an example:
We want to view all Accounts owned by Ria J that are direct customers or resellers.
Filter 1: Account Owner equals Ria J
Filter 2: Type equals Customer – Direct
Filter 3: Type equals Channel Partner / Resellers
We’re going to face an issue here, filters 2 and 3 conflicts with each other; resulting in the report returning no data. How do we resolve this? Let’s add a filter logic.
Follow these steps after applying the three filters mentioned above, after which we can apply the filter logic:
1. Click on the downward arrow next to Filters, and select Add Filter Logic.
2. Set filter logic to 1 AND (2 OR 3)
3. Click Apply.
And now, you should be able to view a report that includes all the information we require! Yes, it’s as simple as that.