8.9 Treemap and Sunburst
1. Show membership and size without counting the same amount twice
A trainee sees a shop's sales divided by city and by area within each city. She wants to show how large each city is, while keeping its internal areas visible. An ordinary bar chart can compare all seven area totals, but it may not show which smaller region belongs to which larger group. A treemap uses neighboring rectangles inside parent groups. A sunburst uses nested rings to show levels of the same hierarchy. Both can show a confirmed partition of the original sales.
Imagine a practice view of a marketplace seller inspired by shopping platforms such as Amazon. The amounts and reporting territories here are fictional. The two top-level groups in the model are Pune and Nagpur, and each row supplies an area belonging to one group. The names make the training data easy to discuss, without asserting an official administrative boundary. The figures use ₹ thousand and one reporting window. Start by ensuring every reported amount is included exactly once at the lowest level you want to display.
Keep one path and one value per leaf. Let the chart combine genuine component rows into parents. Keep the already calculated parent totals as independent checks.
Identify the pieces of a hierarchy
- Parent. Pune is one larger group in the fictional report. Its amount combines verified sales assigned to its constituent areas.
- Child. Baner or Kothrud is below Pune in this two-level report. A richer model might show stores within areas. Each level adds meaning rather than simply repeating the same label.
- Leaf. A leaf is the lowest item shown. In this exercise one row per area is the leaf table. A shopping transaction table with many rows in an area can be summarized to the intended leaf grain first.
- Path. The ordered parent and child fields identify what belongs together. A repeated name such as Central in two cities can identify different leaves when both parent values are retained.
- Weight. The numeric sales amount controls the displayed size. Do not add counts, percentages and currency values together just because they come from related categories.
Choose the chart by the task. The rectangles in a treemap can make relative space and membership visible in a compact area. A sunburst makes the ancestry of a sector visible as you move outward. A sorted zero-based bar chart or table is still useful when readers need to compare close amounts exactly. Do not claim which shape is best without considering how many levels and labels the reader needs.
2. Lab. Check a two-city hierarchy, then build a treemap
Goal. Confirm each of seven area amounts and reconcile the two parent totals before visualizing them. Open a sheet called City Area Sales. Enter A1:C8 as shown, with labels as text and numeric sales in ₹ thousand. City repeats to name the appropriate parent for every area. The parent and grand totals do not appear in this chart input range.
| City | Area | Sales (₹ thousand) |
|---|---|---|
| Pune | Kothrud | 240 |
| Pune | Hinjewadi | 200 |
| Pune | Baner | 160 |
| Pune | Hadapsar | 120 |
| Pune | Wakad | 80 |
| Nagpur | Dharampeth | 150 |
| Nagpur | Sitabuldi | 50 |
Check how seven leaf rows make two parent groups
Read each source path
Pick Pune and Baner in one row. Its 160 belongs to that one parent-child path. Confirm seven numeric values and no parent total rows. Inspect both City and Area for unexpected blanks or naming variants.
Verify the parent summaries elsewhere
Use the formulas below or a separately checked summary. Pune should total 800, Nagpur 200 and both together 1000. Write the unit beside these checks. The totals help validate the plotted parent group sizes.
Insert Treemap on a supported build
Select A1:C8 and choose Insert, Hierarchy Chart, Treemap where available. Verify the largest parent group is Pune and the largest Pune leaf is Kothrud. Look for exactly seven leaves. The visual order can vary with Excel's layout.
Check labels and readability
Where supported, select the series format and try the treemap's label options. A parent banner can help identify a group. Keep a legend, labels or table that names the groups so color is not the only cue.
Calculate each meaningful share
Kothrud is 30 percent of Pune and 24 percent of all listed sales. Dharampeth is 75 percent of Nagpur and 15 percent of the overall total. The same leaf has two valid fractions with different denominators.
Pune total =SUMIF(A2:A8,"Pune",C2:C8)
Nagpur total =SUMIF(A2:A8,"Nagpur",C2:C8)
Leaf total =SUM(C2:C8)
Compare area, rather than rectangle width alone
The treemap can pack values into rectangles of different proportions. One long thin rectangle can have less area than a shorter, wider one. In the teaching figure Pune covers 80 percent of the total plotting rectangle. Inside it Kothrud is 30 percent of the parent area. Multiplying those shares gives 24 percent of the total. Excel may choose a different layout and shape proportions, so use labels and exact data rather than judging a close comparison by one side length.
The chart needs one compatible weight across groups. A raw percentage such as 80 percent of Pune is not directly comparable by area to 75 percent of Nagpur unless you define what the differing populations mean. Use amounts for contribution to the combined sales total. If you want a separate comparison of within-city mix, keep denominators explicit and consider separately normalized bars. Every chart should declare whether its plotted weights are amount, count or a correctly defined share.
3. Lab. Read the same hierarchy as city and area rings
Goal. Use the original seven leaves to build a sunburst and read three nested percentages. Make a copy of City Area Sales. Keep A1:C8 as its original source, with verified labels and numbers. The innermost data ring corresponds to the City level and the next ring represents Area. The central hole in the teaching illustration is a label space, separate from the data rings.
- Insert the named chart type directly. Select A1:C8 and use Insert, Hierarchy Chart, Sunburst where your Excel build offers it. Do not rely on a recommendation prompt to prove a fully populated table is valid. Microsoft describes differences between explicit insertion and automatic recommendations.
- Read the inner city partitions. Pune contributes 800 out of 1000, so its 80 percent corresponds to a 288-degree sector. Nagpur is 200 out of 1000, or 72 degrees. Together they fill the circle.
- Trace a child from its parent. Locate Kothrud in the part of the outer ring within Pune's boundaries. Its angle describes 240 out of the entire 1000, or 86.4 degrees. Dividing 86.4 by Pune's 288 gives 30 percent of that parent. Both percentages come from the same numeric source amount.
- Verify right-sized comparisons. Inside Nagpur, Dharampeth is 150 out of 200 and Sitabuldi 50 out of 200. Their angles along the full circle are 54 and 18 degrees. The parent ring's 72 degrees equals their sum. Use a table for exact values if the smaller leaf labels are hidden for space.
- Check changes at each level. On a copy change Baner's amount to 180. Pune then reaches 820 and the overall total becomes 1020. The parent totals and child angles should reflect the same new population. Restore Baner to 160. Do not compare the new chart's parent percentages to old underlying counts.
Distinguish a hierarchy from a multiple-series doughnut
In a multi-series doughnut, different rings can represent separate sets of categories or periods, each normalized to its own sum. In this sunburst, a child arc must fit within its specific parent's arc across the levels. The rings are two ways of reading the same sales, not additional amounts to be added to each other. Reading the 800 inner Pune sector and then adding its outer 800 would double-count those sales. Keep a companion table with clear row roles. If the intended comparison is two independent populations with the same categories, a normalized bar comparison is often easier to read.
Extend the path by one level in a controlled test
Suppose the group supplies two nonoverlapping subdivisions of Kothrud. Copy the source and add a new Category or Subarea field between Area and Sales. Replace the original Kothrud 240 row with two rows: Pune, Kothrud, North, 150 and Pune, Kothrud, South, 90. For the other six area rows use a label Whole area in the new level if you want a complete three-column path. That label simply records that those areas have no finer split in this report. It should not create a second row for their old value.
The new source has eight leaf rows but still totals 1000. Kothrud remains 240 and Pune 800. Its North leaf accounts for 62.5 percent of Kothrud, 18.75 percent of Pune and 15 percent of the overall total. Check that the parent line is the sum of its descendants. In a three-level sunburst, moving farther outward indicates the added detail. If it becomes too small to name on the chart, show the full path and amount in a linked or nearby table.
If you leave the old Kothrud 240 value as a new extra leaf along with its two subdivisions, the chart input falsely totals 1240. Include either the old area-level row or its replacement children for the same scope. A valid hierarchy can have branches of different depth when the chart supports them, but an extra level should not introduce a duplicated measure. Keep original totals for validation outside the plotting range.
4. Shape the worksheet so hierarchy levels have clear meanings
Use named parent and child columns rather than a wide matrix
A worksheet can begin with City in one column and several area names as separate headers, each holding a numeric amount. That matrix might work as a human summary. The hierarchy chart needs to associate each numeric value with a path. Make a controlled long-form source on a copy. Put City in the first column, Area in the second and the numeric weight last, with one row per approved combination. When a large import has these area fields in columns, Power Query's Unpivot step can reshape them into attribute and value fields where available. Verify the newly generated rows and units before charting.
Start with a known control. A wider source might show Pune in one row with 240 under Kothrud and 200 under Hinjewadi. After reshaping that part, the two output rows each repeat Pune, name their own area and keep their respective amounts. The subtotal remains 440. If the new table only keeps the first area name and both amounts, it cannot reproduce the original hierarchy. Check a parent with more than one child and one missing optional child label. Keep unverified combinations out of the approved chart data until their meaning is known.
Keep repeated names tied to their parents
Two stores can use the label Central under two different regions. A path consists of City and Area together, so Central is not the same identifier across all parents. In a lab copy you can try repeating an area label under Pune and Nagpur while retaining separate amounts. When building a summary or lookup, check matching parents too. If source City is missing, do not infer it from the similar area name without a verified map. A convincing hierarchy layout can conceal data that were merged under the wrong parent.
Use a stable grouping key where possible. If one row uses an extra space or alternate spelling, the chart can show a new category instead of combining it with the intended parent. Make a reviewed label map using the course's data-cleaning steps. If you see the same area twice under one city, determine whether those are separate transaction rows to aggregate or a duplicate export record. Sum only compatible, permitted values from independently verified contributions. Preserve the raw worksheet and distinguish new sales from repeated imports.
Treat blanks and zero weights according to the data contract
Microsoft documents that hierarchy charts can be plotted when there are blanks in the level structure. A blank field still has a business meaning to check. It might be an expected end of a shorter path, a missing city, a total row from an earlier display or bad source entry. In the two-level exercise every leaf has both names. In an optional deeper tree, a legitimate terminal area can remain at that level if the chosen chart handles it and you verify its display. A named Whole area group in the earlier practice is one explicit way to model intentionally unexpanded branches.
Use nonnegative, comparable sizes and reconcile any zero or unknown measurement separately. A legitimate zero amount has no area or angular width. A missing amount may mean that the full total is not known. Do not add an invented small value to make a missing rectangle visible. If differences can be negative because you are showing refunds or changes, a signed bar or waterfall can preserve direction. A size proportional to an amount cannot represent direction by itself.
5. Preserve denominators when making a hierarchy easier to read
Group small leaves within their original parent
If a presentation version of the chart only has room for a few detailed Pune labels, consider making a combined row for that parent. Create a new approved summary on a copy. Combine Hadapsar 120 and Wakad 80 into Other Pune areas 200. Keep Kothrud 240, Hinjewadi 200 and Baner 160. Verify Pune still totals 800 and the complete chart still sums to 1000. The source table preserves both original members so readers can find their separate amounts.
Other Pune areas is a group, not a fourth original area with its own observed sales. Its displayed amount of 200 equals Hinjewadi but the comparison is between a bundle and a single area. Label the membership. If the audience needs to rank all original areas precisely, keep a separate bar chart or list. Do not rank a mixed group with individual leaves without explaining that change in grain. When changing the report over time, use one consistent grouping policy or disclose why an Other group changed its membership.
Check what changes when a leaf is dropped instead of grouped
Remove Sitabuldi's 50 from a test copy without putting it in a group. The visible total is now 950 and Nagpur's shown amount falls to 150. The original verified report for both cities was 1000. The Pune amount stays at 800 but its share of visible data rises from 80 percent to about 84.2. Kothrud's displayed share of visible total increases from 24 percent to about 25.3. Its original amount has not changed. A chart titled all reported city sales would now misstate its own denominator.
Use a top-N filter only when you intend to show a subset. In that case, write the cutoff, which items are included and whether parents still show their full or visible totals. This changes the question from how sales are partitioned across all groups to how the selected part is divided. An accurately sized layout has no way to announce categories that were omitted unless you supply a label or audit note. Grouping and filtering are different operations.
Keep independent parent totals out of the leaf input
On one disposable test copy, add a Pune row with Area set to Total and Sales 800, after the seven leaf rows. If the extra row is treated as another leaf, the chart input sum becomes 1800, Pune appears to have 1600 and its share is now about 88.9 percent. The new Pune block looks larger even though none of its area sales changed. Both the exact parent checks and row roles expose the mistake. Remove the extra input row, keep the calculation outside the selection and verify seven leaves and two parents again.
A similar error happens if there is a city total for both Pune and Nagpur among the source data. Now 2000 appears to be the whole and each parent's percentage might still read 80 and 20. Checking percentages alone would miss that equal double counting. Check the absolute independent total too. The correct shares and the correct magnitude are separate requirements. A visual that uses a fixed full rectangle or circle can hide inflation unless you validate the original sums.
6. Verify the hierarchy in the chart and its companion table
Choose the view for membership, relative size or exact comparison
For the question which city has the most sales, a two-bar comparison of 800 and 200 can answer quickly. For how Pune's total divides, the treemap shows its rectangles within the parent group. For which subarea belongs under which area in a three-level report, a sunburst can make the outward path visible. Use a table for exact amounts and paths. None of these choices requires adding a different summary amount to the child measures. Start with the checked leaf source and derive each valid view from it.
One hierarchy can appear visually different when the chart bounds or packing are changed. A treemap fits rectangles differently in a narrower frame. The shape or adjacency of individual leaves can change without changing their values and parent membership. A sunburst's angular partition can rotate, but the relationship between child and parent should stay consistent. Use labels rather than relying on the original relative location of an item in a screenshot. If the figure is shared at mobile width, check visible names and provide a fallback table.
Trace the value from source to image
- Write one intended path. Start with Pune, Kothrud and 240. Verify the exact row and the city in a text table. Use the unit ₹ thousand consistently.
- Calculate the parent and whole independently. For this path, divide 240 by 800 for the within-city answer and by 1000 for the overall result. Check the other parent totals too.
- Verify hierarchy levels and labels. A chart should show Pune as a parent and Kothrud as its leaf. If level names are swapped or one is missing, inspect the column order and field meanings before changing the design.
- Judge size from the encoding. A treemap's area represents magnitude. A sunburst child's angle represents part of whole and belongs within its parent's sector. Do not read a rectangle's horizontal width or a ring's radius as a value.
- Check any accepted grouping or filter. Confirm whether Other includes the same original paths after a refresh. Recompute total and visible scope if a report no longer includes all children. Compare with the known original.
- Review each display for readability. Use a meaningful chart title and alt text. Ensure smaller entries remain available in a table. Check an example of both a parent and a child from the chart as well as the source.
Use the Excel Task Hub for another structured comparison. Before charting several levels, write what one leaf represents and which group totals should result. The next lesson, Map Chart, teaches how to compare geographic regions as mapped areas. A hierarchy whose labels happen to be city names does not use coordinates or imply geographic adjacency. It represents membership and values, not a map.
Make a worksheet check for multiple rows that belong to one leaf
On a separate transaction-grain copy of City Area Sales, replace the first Kothrud amount 240 with 140. Append Pune, Kothrud and 100 as a new independently verified contribution in A9:C9. This is a demonstration of two additive inputs to the same path, rather than two areas. The ungrouped work sheet now has eight source records, totaling the same 1000. Use a separate leaf output that still has seven unique city-area pairs. In that output's first Kothrud calculation, test the conditional sum below. The correct Kothrud amount remains 240.
=SUMIFS(C2:C9,A2:A9,"Pune",B2:B9,"Kothrud")
Adjust the range and the criteria deliberately when building a repeatable summary. You can match the approved City and Area fields against source columns in a PivotTable, a query or worksheet formulas. Include the reporting period if the source combines months. If the city label is not reliable, use an approved stable key before relying on a text match. Compare the number of distinct output paths and the grand total against the exact input. This confirms the new contribution was added once, allocated to the intended leaf and allowed to retain its meaning.
Now interpret the 100 row as an accidental replay rather than a new contribution in a separate negative-control discussion. The decision whether it should contribute does not come from matching the path. In a live transaction export you would compare the record key, order line, period and source eligibility. Some repeated paths legitimately represent separate observations. A removed replay and a grouped valid transaction can both reduce the number of plotted rows while representing different business decisions. Keep those decisions visible in the audit.
Choose the comparison level before sorting by size
In the original report, Pune's 800 is greater than Nagpur's 200. Within Nagpur, Dharampeth's 150 is three times Sitabuldi's 50. The largest individual area across both cities is Kothrud at 240. A leader at one level is not automatically the leader at another. For example, Dharampeth's 75 percent share of Nagpur is larger than Kothrud's 30 percent share of Pune, while Dharampeth has fewer rupees. A sentence that calls Dharampeth the largest needs to name the denominator or comparison group.
Try three one-sentence captions, one about the parent totals, one about the largest area amount and one about the largest within-city proportion. Keep a precise list of the source facts beside the plot. When someone points to the ring or rectangle they can tell which comparison they read. This prevents a proportion claim from being mistaken for an amount. A separate chart with a pair of length comparisons might be clearer when a meeting expects precise rankings across parents and values.
Run a parent assignment error through the exact checks
Move the original 50 from Nagpur, Sitabuldi to a mislabeled parent Pune without changing any numeric cell on a copy. The global total is still 1000. Pune rises to 850 and Nagpur falls to 150. A report that checks only the grand total and number of leaves would not spot the assignment mistake. An audit that verifies exact paths and parent subtotals catches it. Keep a verified parent mapping table for uncertain territory or category labels, and compare the chart to that independent rule after reshaping or refreshing.
On a second copy, change only the label of an existing area to an already approved area in the same city. The numeric total again stays the same, but you now have a repeated path. If the two underlying records genuinely belong to one area, the approved output should group them. If the change was a mistake, restore the source identity. This control teaches you to detect misallocation even when the area totals still add up correctly.
Keep the period and comparison scope when sharing two figures
Suppose the next period has a total of 800 across the same two cities, with Pune still contributing 80 percent. Its absolute amount is now 640. Two full-sized treemaps use the same whole plotting rectangle even when the total amounts differ. Pune can occupy 80 percent of each rectangle while its amount changes from 800 to 640. Two sunbursts can show the same parent angle for the same reason. State period totals and use a common-scale bar or numeric table when the question is about an amount over time.
A hierarchy chart measures proportion within the displayed hierarchy. Resizing the whole plot to fit a dashboard does not directly express a change in the underlying grand total. On a small screen, people may see a larger card simply because it appears in a wider column. Check titles and units so physical screen space can be understood separately from the data encoding. Take a sample parent and leaf and verify both percentage and amount from the stored values.
Check whether a numeric measure can be summed across the leaves
The worksheet adds sales amounts. Some numeric fields need different logic. Suppose two areas have return rates of 20 percent and 5 percent based on 10 and 200 orders. The original return counts are 2 and 10. The combined rate is 12 of 210, about 5.71 percent. It is not 25 percent. If you want to show an amount that partitions a whole, use a verified additive measure such as orders or returns, and place the correctly computed rate in a separate table or chart. A rounded average or percentage generally cannot be added directly to its siblings.
Check whether the same person can belong to several branches. A workbook may count each buyer once per area while a multi-area customer is present in two groups. The sums then measure area memberships, not necessarily distinct buyers overall. If your chart claims distinct people as its whole, establish a rule assigning each person once or choose a different display. Hierarchical pictures assume the supplied parts can fill the parent. They do not validate the uniqueness of people or any other source entity.
Plan for unfamiliar or missing path endings in an import
If a file contains a blank subarea under a known area, check whether the finer detail is truly absent by design or accidentally missing. A deliberate area-level amount can be displayable as a terminal value where the tool supports it. An area subtotal alongside already supplied subareas is not a terminal contribution. Treat it as an audit row. Mixed-depth hierarchies require you to know whether each numeric value is direct sales at its level, or an aggregation of children. Write that role explicitly before plotting.
For a teaching worksheet a controlled label such as Whole area can make that meaning easier to read. It should only receive the amount that the notes say is unsplit. If later deliveries split that group, make a source revision and replace the placeholder leaf with its approved children. Reconcile totals and counts. Do not silently leave both. A valid chart offers an inspectable answer even as new area details are added.
Build a final checklist for a colleague who will alter the next version. Include the known parent totals, count of approved leaves, reporting window, weight type and shortcut to the exact data table. Ask them to test adding one real child and removing one unapproved source path on a disposable copy. The exercises then tell them how the approved amount, parent and display should react. A chart that passes those checks is easier to maintain than one built from a screenshot alone.
7. Interview questions with worked answers
How do you prepare data for a treemap or sunburst?
Use one field for each hierarchy level and one numeric weight field. Define one leaf per approved path and include only the component values in the chart input. A worksheet with Area spread across several columns can be reshaped and reconciled before charting.
When would you prefer a treemap over a sunburst?
A treemap is helpful for a compact view of relative sizes within parent groups. A sunburst highlights the path from inner levels to outer members. For precise exact comparisons between close values, consider bars or a table.
Should parent totals be included next to their component rows?
Keep the already summed amounts outside the plotted leaf range. If Pune 800 appears again as an Area named Total alongside the seven area records, the same sales can enter the chart twice. Check both the global amount and the parent sums.
Can two leaves have the same label?
Yes, if the full paths distinguish them. A label Central under Pune and one under Nagpur can be different area groups. Preserve the parent fields and verify whether repeated paths within one parent should be aggregated or treated as a duplicate source.
What is the difference between grouping a leaf and dropping it?
Grouping keeps its value in the relevant parent's and overall totals. Dropping it changes the plotted population. Use Other within the same parent when preserving the whole and state the membership, or label a deliberate subset with its new denominator.
8. Predict the membership or share
What share of Pune and the whole does Kothrud represent?
It is 240 of Pune's 800, or 30 percent, and 240 of the chart's 1000, or 24 percent. Both come from one source amount and use different denominators.
What does the Nagpur city sector angle measure?
It is 200 of 1000, so the sector spans 72 degrees. The Dharampeth and Sitabuldi child sectors cover 54 and 18 degrees of the full circle within that span.
Will grouping Hadapsar and Wakad remove their sales from the total?
Keep both amounts in one clearly defined Other Pune areas row totaling 200. The Pune total remains 800 and the full chart sum stays 1000. A detail table should identify both members.
A chart renders the same percentages after both parent totals were added to the source. Is its magnitude still right?
No. Adding the parent values to the leaves doubles all contributions to 2000. The ratios might stay identical. Verify the amount and the role of every plotted row as well as the shares.
Does a shape that is wider necessarily have a larger value in a treemap?
Area is the encoding. A long thin rectangle can have less area than a narrower, taller rectangle. Check the original weight or exact label for close comparisons.
9. Six reminders
- Name all levels.
Each path has explicit parents, children and a stable evidence-bearing source.
- Plot leaf values once.
Keep already aggregated totals for external reconciliation.
- Read area or angle correctly.
Treemaps show magnitude with area; sunburst sectors reveal nested shares.
- Separate within-parent and overall.
Both fractions can be correct and use different denominators.
- Group without hiding.
Keep the membership and total when rolling up small leaves.
- Offer an exact view.
Use an accessible table for small segments, full paths and precise values.