← Back to the hackathon home
Topic 12 of 18

DHIS2 Data Visualizer

Step by Step Guide: Building Pivot Tables and Charts, Using ANC Visits as the Example

Purpose of this guide

Data that has been entered is of no use until somebody looks at it. This guide builds a pivot table and then every kind of chart from the same selection, so you can see what each one is good for. It uses the four ANC visit data elements, because they hold data in every demo, and the steps are identical for your own malaria data elements and indicators. The charts you save here are what the next topic puts on a dashboard.

Step 1: Open the Data Visualizer

Charts and pivot tables are built in the Data Visualizer. Open the apps menu and pick it from the list, or type the first letters of the name.

Click: Apps menu → Data Visualizer
The apps menu open on a dashboard, with the Data Visualizer app in the list
Figure 1. Finding the app.
  1. 1Search apps. Type visual to shorten the list.
  2. 2Data Visualizer. Charts, pivot tables and single values. This guide uses it.
  3. 3Maps. The same kind of work, on a map.
  4. 4Dashboard. Where the finished charts are placed, which is the next topic.
Step 2: Know the Workspace

The app opens on an empty pivot table. Everything you build is made of three things: the type of visualisation, the dimensions you pick, and where you put them.

The Data Visualizer as it opens, with the layout bar and the dimensions list
Figure 2. The workspace.
  1. 1Visualisation type. Pivot table to start with. Every chart type sits behind this menu.
  2. 2Update. Draws the visualisation with the choices you have made. Nothing appears until you click it.
  3. 3Columns. What runs across the top.
  4. 4Rows. What runs down the side.
  5. 5Filter. What the whole visualisation is limited to, without showing it.
  6. 6Data. The data elements, indicators and data sets you want to see.
  7. 7Period. Which months or years.
  8. 8Organisation unit. Which facilities, districts or the whole country.
Step 3: Choose the Data

Click Data in the left list. Choose the type on the left of the window, for example Data elements or Indicators, then move the items you want to the right hand list and click Update. This guide uses the four ANC visit data elements as its example, because they exist in every demo.

Click: Data → Data elements → ANC 1st visit, ANC 2nd visit, ANC 3rd visit, ANC 4th or more visits → Update
For your own work: pick the malaria data elements you created, or the indicators from Topic 6. The steps are exactly the same whichever you choose.
Step 4: Choose the Organisation Unit

Click Organisation unit. You can tick units in the tree, or choose a whole level or group, which is usually what you want for a chart.

The organisation unit window with the tree and the level and group selectors
Figure 3. The organisation unit window.
  1. 1User organisation unit. Whatever the person opening the chart is attached to. Useful for a chart that many people share.
  2. 2User sub units. The units one level below that person.
  3. 3The tree. Tick a district or a facility by hand.
  4. 4Select a level. Every unit at one level, for example every district.
  5. 5Select a group. Every unit in a group, for example every CHC.
  6. 6Update. Applies the choice and redraws.
The level list open, showing National, District, Chiefdom and Facility
Figure 4. Choosing a level.
  1. 1Select a level. The list of levels in the hierarchy.
  2. 2District. Gives one line, bar or row per district.
  3. 3Chiefdom and Facility. The same idea, further down. Use them with care, as a facility chart can hold hundreds of lines.
The group list open, showing CHC, Chiefdom, CHP, Clinic and others
Figure 5. Choosing a group.
  1. 1Select a group. Organisation unit groups, such as the type of facility.
  2. 2CHC. Every community health centre.
  3. 3District. Groups and levels can be combined, for example every CHC in one district.
Sierra Leone ticked in the tree, with one org unit selected
Figure 6. One unit chosen.
  1. 1The tick. Sierra Leone is selected, so the chart shows the whole country as one line.
  2. 2Sierra Leone. Click a name to tick it, click again to untick it.
  3. 3Selected. The line under the tree always says what is chosen.
Step 5: Choose the Period

Click Period. Relative periods move with time, which is what a dashboard needs, and fixed periods stay where they are, which suits a report about one month.

The period window with relative periods and Last 12 months selected
Figure 7. Choosing the period.
  1. 1Relative periods. Last 12 months, this year, last quarter. The chart updates itself every month.
  2. 2Fixed periods. A named month or year, such as September 2026.
  3. 3Period type. Months, quarters or years.
  4. 4The list. Click an item to move it to the right.
  5. 5Selected periods. What the chart will use.
  6. 6Update. Applies the choice.
Rule of thumb: use Last 12 months for a trend on a dashboard, so nobody has to edit the chart next year.
Step 6: Click Update and Read the Table

With data, period and organisation unit chosen, click Update. The pivot table appears, and it is worth reading before drawing any chart, because it shows exactly the numbers the chart will use.

The pivot table with the four ANC data elements as columns and twelve months as rows
Figure 8. The numbers behind the chart.
  1. 1Data in Columns. The four data elements run across the top.
  2. 2Organisation unit and Period in Rows. The country and the twelve months run down the side.
  3. 3Column headings. One per data element.
  4. 4The months. September 2025 to August 2026, from Last 12 months.
  5. 5The values. The same numbers every chart below is drawn from.
Step 7: Switch to a Chart

Open the visualisation type menu at the top left. Each type suits a different question, and the description under each name says what it is for.

The visualisation type menu with pivot table, columns, bars, line, area, pie and the others
Figure 9. The visualisation types.
  1. 1The menu. Click the name at the top left to open it.
  2. 2Pivot table. The numbers themselves.
  3. 3Column and bar. Comparing sizes.
  4. 4Line and area. Change over time.
  5. 5Open as Map. Sends the same selection to the Maps app.
Step 8: Change Over Time: Line and Area

A line chart answers how something has moved month by month. An area chart does the same but stacks the series, so the height of the whole shape is the total.

A line chart of the four ANC data elements over twelve months
Figure 10. Line, one line per data element.
An area chart of the same four data elements
Figure 11. Area, the same data stacked.
Use a line when the shape of the trend matters, and an area when the total matters as much as the parts.
Step 9: Comparing Sizes: Column and Bar

Columns stand up and bars lie down. They carry the same information, so the choice is about the labels: long names read better on a bar chart.

A column chart of the four ANC data elements by month
Figure 12. Column, months across the bottom.
A bar chart of the same data
Figure 13. Bar, the same data with the labels on the left.
Rule of thumb: more than about eight labels, or long names such as facility names, read better as bars.
Step 10: Parts of a Whole: Stacked Charts and Pie

Stacked charts show the parts and the total at the same time. A pie chart shows the shares at one point in time, so the period usually goes in the filter.

A stacked column chart of the four ANC data elements
Figure 14. Stacked column, the total and the parts.
A stacked bar chart of the same data
Figure 15. Stacked bar, the same idea lying down.
A pie chart of the four ANC data elements over the last twelve months
Figure 16. Pie, the share of each over the whole period.
Keep pies small: four or five slices at most. Beyond that, a bar chart is easier to read.
Step 11: Compare Years: Year Over Year

Year over year puts this year against last year on the same twelve months, which is the quickest way to see whether a season is worse than usual.

A year over year line chart comparing this year with last year
Figure 17. Year over year, as lines.
  1. 1Series. This year and last year, instead of a period list.
  2. 2Category. Months per year, so January sits above January.
  3. 3Filter. The data and the organisation unit move into the filter.
A year over year column chart of the same comparison
Figure 18. Year over year, as columns.
Step 12: Choose the Right Chart
The questionThe chart
What are the numbersPivot table
How has it moved over the monthsLine
How do the parts add up over timeArea or stacked column
Which is biggerColumn, or bar for long names
What share does each havePie
Is this year worse than last yearYear over year
Where is it happeningOpen as Map
One question, one chart. A chart that answers two questions usually answers neither. Build a second chart instead.
Step 13: Save the Chart for the Dashboard

A chart has to be saved before it can be put on a dashboard. Give it a name that says what it shows, including the period and the level, so it can be found later.

Click: File → Save as → name → Save
Good nameMalaria: confirmed cases by district, last 12 months
Poor nameChart 1
Expected result: The chart is saved and can be added to a dashboard in the next topic.

Final Checklist