Sub topic 11
Joined Reports: Combining Blocks
This chapter assumes you can build summary and matrix reports, apply filters, and write basic custom summary formulas. It covers how a joined report combines several blocks, what each block can and cannot share, and the errors that most often catch people out.
What a joined report is
A joined report is a report with up to five blocks. Each block is its own report: it has its own report type, filters, columns, and groupings. The blocks sit side by side in one view. You can read them together, but Salesforce does not merge their rows.
This is the main difference from a summary or matrix report. Those formats pull from one report type, so every row comes from the same set of related objects. A joined report can pull from several report types at once. For example, one block can show Opportunities and another can show Cases, both for the same accounts.
Joined reports are built in the Lightning report builder. You start by choosing a report type for the first block, then add more blocks. Each added block can use a different report type.
Anatomy of a joined report
Each block is a self-contained summary-style report. Its parts are:
- A report type that decides which objects and fields the block can use.
- Block-level filters that apply only to that block.
- Columns and summary fields that belong to the block.
- Row groupings that organize the block's records.
The report as a whole adds two things on top of the blocks:
- Standard filters, such as date range and scope. Some of these apply across every block.
- Common groupings, which are groupings that every block shares. Cross-block formulas can use these.
Building a joined report
Follow these steps to build a report that compares opportunities and cases by account.
- In Reports, select New Report, then choose the report type for your first block, such as Opportunities.
- Open the format menu and switch to Joined. The first block appears as Block 1.
- Group Block 1 by Account Name. Add a summary on Amount (sum).
- Select Add Block and choose a second report type, such as Cases. The picker offers the report types you can use.
- Group Block 2 by Account Name. Add a summary on Record Count.
- Filter each block on its own. Block 1 might show only closed-won opportunities. Block 2 might show only cases with Status not equal to Closed.
- Run the report and check that the Account Name values line up across blocks.
Name each block clearly. The block name becomes the label you see in formulas and charts, so "Closed Won Opps" is more useful than "Block 1".
Common groupings
A common grouping is a field that is grouped in every block and is recognized as the same field across blocks. Salesforce can match values from different report types on a shared field, such as Account Name, Owner, or a date. When the field is shared, the report builder lists it as a common grouping. You can then:
- Use it to line up rows from different blocks.
- Write cross-block formulas that combine values from different blocks for the same group.
- Build charts that plot several blocks against the same axis.
The report builder offers a field as common only when each block has it available. If a field does not appear as a common grouping, check that every block groups by it and that each report type exposes it.
Date fields need extra care. Blocks from different report types may use different date fields, such as Close Date for opportunities and Created Date for cases. Group by a date field that exists in all the blocks, and pick the same granularity (day, month, or quarter) in each.
Cross-block summary formulas
Once blocks share a common grouping, you can create a cross-block custom summary formula. This formula uses summary values from more than one block. A typical use is a ratio, such as closed-won revenue per open case for each account.
The formula refers to a summary in a block through the block name. The exact syntax is BlockName#FIELD:SUM. A formula that divides Opportunity revenue by case count looks like this:
Closed_Won_Opps#AMOUNT:SUM / Open_Cases#RowCountHere the block names are Closed_Won_Opps and Open_Cases. Set the formula's grouping level so the result is computed for each value of the common grouping, in this case each account.
Be careful with division. If a block has no rows for an account, its value is empty and the division fails or shows a blank. Guard against that with IF:
IF(Open_Cases#RowCount > 0, Closed_Won_Opps#AMOUNT:SUM / Open_Cases#RowCount, 0)What each block can and cannot do
Joined reports are flexible, but they have limits. Plan around them early.
| Feature | Joined report behavior |
|---|---|
| Blocks | Up to 5 per report |
| Report types | Each block can use a different type, within the joined report limits |
| Row groupings | Each block groups on its own |
| Column groupings | Not available as in a matrix; blocks use row groupings |
| Filters | Block filters apply to one block. Standard filters can apply to all |
| Bucket fields | Supported per block |
| Row-level formulas | Supported per block |
| Export | Joined reports cannot be exported as a data file the way tabular reports can |
| Subscribing and scheduling | Available, with some format limits |
Charts and dashboards from joined reports
A joined report can include a chart. The chart can plot summary values from several blocks against a common grouping. This is useful when you want to compare, for example, revenue and case count by account on one chart.
Dashboards are more restrictive. A dashboard component draws on a single report with one set of results. Because a joined report has several blocks, dashboard support is limited. Components built on a joined report show only a subset of the report's data, and some chart types are not available. If you need a dashboard component, a summary or matrix report is often the safer base.
Test the dashboard step before you build the whole report. Add a component from your joined report to a test dashboard and confirm it shows what you expect.
Common errors and fixes
- The rows do not line up. The groupings are on different fields, or one block groups by a field that looks the same but is not shared. Group every block by the same field.
- A block shows far fewer rows than expected. A block filter is too tight, or the report type requires related records that some rows lack. Check the "with / without" setting of the report type.
- A common grouping option is missing. One report type does not expose the field. Pick a different field or report type.
- The formula returns a blank or an error. A block has no data for that group. Wrap the formula in
IF, as shown earlier. - Totals look wrong when you add them up. Each block counts its own records. A record can appear in two blocks, so adding block totals together can double count.
- The dashboard component is missing. The joined report is not available as a source for that component type. Use a summary or matrix report as the source instead.
When to choose a joined report
Choose a joined report when the question spans more than one report type and you want the answers on one page. Examples are "which accounts have large revenue and many open cases" or "pipeline and activity by owner".
Choose a summary or matrix report when one report type holds all the data. They are simpler, support more chart and dashboard options, and are easier to maintain.
Exercise
You build a joined report with an Opportunities block and a Cases block, both grouped by Account Name. A cross-block formula that divides opportunity amount by case count returns errors for some accounts. What is the likely cause, and how do you fix it?
Show answer
Some accounts have no cases, so the Cases block has no value for them and the division fails. Wrap the formula in an IF that checks the case count first, for example IF(OpenCases#RowCount > 0, ClosedWonOpps#AMOUNT:SUM / OpenCases#RowCount, 0).
Exercise
Why might adding up the record counts from all blocks overstate the number of distinct records in a joined report?
Show answer
Each block counts its own records independently. If the same record meets the filters of more than one block, it is counted once in each block, so the sum double counts it.