Skip to main content

I created a custom report type using "A with or without related records from B". Then I built a report to show the count of B records per A.

However, I'm seeing an issue: when an A record has no related B records, the report subtotal still shows 1 instead of 0. As a result, the overall count is inflated and doesn't reflect the actual number of B records.

Why does this happen? Is there something I am missing during configuration?

 

 

FYI : A is the parent object, and B is the child object in a one-to-many lookup relationship 

 

#Salesforce Developer  #Salesforce Admin  #Reports & Dashboards

2 件の回答
  1. 9月7日 9:44

    Hi @Chirag Chakraborty

     

    This is expected behavior with "with or without related records" report types not a bug or misconfiguration. 

    Why it happens: When A has no related B records, the join still produces one result row for that A record (with all B fields null), so it counts as 1 in the grouped subtotal. The report is counting rows, not counting non-null B records. 

     

    Fix - use a Row Count that actually reflects population: 

    • Instead of subtotaling on a generic count, subtotal on a specific B field (e.g., B's Record ID or Name) using Record Count in the summary. Some report builders let you choose "Row Count" vs count-of-a-field - count of a specific child field still won't fix it directly, since Salesforce's summary "Record Count" always counts rows, not non null field values.

    The more reliable fixes: 

     

    1. Add a filter: B: ID not equal to blank - this excludes the phantom join rows entirely, so A records with zero children don't appear in the grouped count at all (they'll simply be absent, not shown as 0).
    2. If you need to see A records with zero B's explicitly (shown as 0, not omitted): standard reports can't easily distinguish "1 phantom row" from "1 real row" in the subtotal you'd need a workaround like a formula field on B that always evaluates true when B exists, then summarize that formula field instead of raw Record Count.
    3. Alternative: build this as a matrix report or use a roll-up summary field on A (Count of B) if this is a recurring need a roll-up avoids the report-join ambiguity entirely and gives you a real 0 when there are no children.

    Quick check: filter your existing report to A.Id is not null AND B.Id is not null and compare subtotals if the inflated total drops to the correct count, that confirms this is the phantom row cause.

0/9000