How to Dynamically Filter Salesforce Report Charts by Record

Salesforce makes it easy to embed report charts directly on record pages in Lightning Experience. But did you know you can make these charts automatically show data relevant to the record you’re viewing? Whether it’s Opportunities for an Account, Tasks for a Lead, or child records for a custom object, dynamic report filtering keeps your charts contextually smart—without any manual filtering.

Here’s how to set it up.

Step 1: Create a Report with a Dynamic Filter

First, create or edit a report that contains the data you want to visualize. The key is to include a filter that links to the record on the page.

  • Use an ID field for the filter, such as:

    • Account ID for Accounts

    • Opportunity ID for Opportunities

    • Lead ID or Contact ID for people-related records

  • Set the filter value to blank. Example: Account ID equals [blank]

  • Save the report.

Pro Tip: Only ID-type lookup fields work for dynamic filtering. Text fields like “Name” or “Subject” won’t work here.

Step 2: Add the Report Chart to the Lightning Page

Next, open the Lightning App Builder and edit the record page where you want the chart:

  1. Drag the Report Chart component onto the page.

  2. In the component’s settings, select the report you just created.

This embeds the chart directly into the record page, ready to filter dynamically.

Step 3: Enable Dynamic Filtering

In the Report Chart component settings, look for “Filter by” or “Use this field to filter report data.”

  • Select the field that matches your report filter (e.g., Record ID or Account ID).

  • This tells Salesforce to automatically pass the current record’s ID into the report filter, ensuring the chart only shows relevant data.

Step 4: Save and Activate

Once configured, save and activate the Lightning page for your desired apps or record types.

Now, whenever a user views a record, the chart automatically updates to reflect only that record’s related data—no extra clicks required.

Common Pitfalls to Avoid

  • No options in “Filter by”: Make sure your report has a compatible ID-based filter.

  • Using text fields: Only lookup or master-detail fields storing record IDs work dynamically.

  • Chart grouping quirks: Dynamic filters control which records appear, not how they’re grouped in the chart.

Real-World Use Cases

  • Display a chart of all Opportunities for the current Account.

  • Show a summary of Tasks for the current Lead.

  • Visualize child records for a custom object directly on its parent record page.

With dynamic report charts, Salesforce makes your dashboards smarter and more context-aware, giving users the insights they need without extra steps.

written help of chat gpt

Next
Next

Road Block: Can’t Use Activities in the Dynamic Related List Component on Lightning Pages