Forum Discussion
Stacked Column Chart Displays Incorrect Total Values After Adding Legend
- 1 month ago
Hi Keerthi_CH ,
Adding `OwningTeamName` to the Legend should not reduce the monthly total by itself. In a stacked column chart, the total of the column should normally be the sum of all visible legend segments for that month.
If the total changes after adding the Legend, it usually means that the Legend field is changing the filter context or that some incident records cannot be assigned to a valid `OwningTeamName`.
I would suggest checking the following points:
1. Check for blank or missing OwningTeamName values
Some incidents may have a blank/null `OwningTeamName`.
When the chart does not use a Legend, those incidents are included in the total count.
But when you add `OwningTeamName` as a Legend, Power BI has to split the incidents by team. If some incidents do not belong to any team, they may not appear as part of the stacked segments, especially if blanks are filtered out.For example, if May shows 234 without the Legend and 141 with the Legend, the missing 93 incidents may be records where `OwningTeamName` is blank or not matched.
2. Check whether OwningTeamName comes from a related dimension table
If `OwningTeamName` comes from a separate Team/Owner dimension table, check the relationship between that table and the incident/fact table.
If some incident records do not have a matching key in the team dimension, they can be counted when no Legend is used, but excluded or grouped differently once the Legend is added.
3. Use an explicit measure instead of the implicit Count
Instead of dragging `IncidentId` directly to the Y-axis and relying on the implicit Count aggregation, I recommend creating an explicit measure.
For example, if each `IncidentId` should be counted once:
Incident Count =
DISTINCTCOUNT ( Incidents[IncidentId] )Or, if each row in the table represents one incident:
Incident Count =
COUNTROWS ( Incidents )Then use this measure in the Y-axis of the stacked column chart.
4. Create a debugging table
To identify where the difference comes from, create a table visual with:
- MitigateDate Month
- OwningTeamName
- Incident CountThen compare the monthly total in the table with the stacked column chart.
Also add a check for blank teams, for example:
Blank Team Incident Count =
CALCULATE (
[Incident Count],
ISBLANK ( Incidents[OwningTeamName] )
)If the missing difference appears under blank or unmatched teams, that explains why the total changes after adding the Legend.
5. Check visual-level filters and interactions
Also verify that there are no filters applied only to the stacked column chart, such as:
- Visual-level filters excluding blank values
- Top N filters
- Cross-filtering from another visual
- Page/report filters affecting `OwningTeamName`
- A filter on the Legend field itselfIn short, I do not think the issue is caused by the stacked column chart itself. Most likely, adding the Legend exposes a data/model issue, such as blank teams, missing relationships, unmatched dimension values, or a different aggregation behavior.
If possible, please share a sample PBIX file with dummy data, or at least screenshots of the data model relationships and the fields used in the visual. That would make it much easier to identify exactly why the total changes when `OwningTeamName` is added to the Legend.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
Hi Keerthi_CH
Totals drop because adding a Legend changes filter context. The chart recalculates counts per team, so implicit aggregation of IncidentId no longer matches the overall total. You can use explicit measure
Incident Count = COUNTROWS('Incidents')
Or force totals with
SUMX(VALUES('Incidents'[OwningTeamName]), COUNTROWS('Incidents'))
This ensures stacked totals equal the table totals