TheLibreOffice.com

LibreOffice Calc Pivot Tables: Build One and Check the Totals

Build a pivot table from six records, verify its calculations, include new rows, and turn the result into monthly reports, percentages, and charts.

Get totals by group. A sheet of rows beside a compact summary.

To create a pivot table in LibreOffice Calc, select a data range with column headings, choose Insert → Pivot Table, and drag the fields you want to group into Row Fields or Column Fields. Put the value you want to calculate in Data Fields, check its calculation, and choose a destination. I recommend a new sheet: it keeps the report separate from the records and gives it room to grow.

The important part comes after the table appears. You need to know whether it is adding amounts or counting records, which rows it includes, and how to update it without losing new data. The example below takes you through those checks, then adds filters, monthly reporting, percentages, and a chart.

Start with records, not an existing report

A pivot table groups source records and calculates a result for each group. It is useful for questions such as “How much did each region sell?”, “How many responses chose each answer?”, or “What was the monthly total?” You can change the grouping without writing a separate formula for every category.

Give each column one field, each row one record, and the first row clear, different headings. Keep dates in one column, regions in another, and all amounts in one amount column. A separate North amount column and South amount column make the source harder to summarize.

  • Remove subtotal and grand-total rows from the source range. A pivot table can add those rows again as if they were transactions.
  • Fill in category labels on every record. A blank Region cell is not automatically an instruction to repeat the region above it.
  • Avoid merged headings and blank separator rows. When you start from one selected cell, Calc detects the surrounding list; a completely empty row or column can stop that detection.
  • Use actual numbers and dates. A currency symbol or a date-looking string on screen does not prove that Calc recognizes the underlying value correctly.

The Calc guide explains automatic range detection: selecting several cells uses that explicit selection instead. For a first report, I prefer selecting the complete range, including headings, so the boundary is deliberate.

Fix text amounts or dates before summarizing

Work on a copy if an imported column has the wrong data type. Select just the affected data cells and choose Data → Text to Columns. In the preview, keep each value in a single column; do not split decimal commas or date separators into extra columns.

  1. For amounts, choose the Language that matches their decimal and thousands separators. Set the preview column type to Standard, or US English for US-formatted numbers.
  2. For dates, select the preview column and choose the correct order: Date (YMD) for the example below, or DMY/MDY for another source. Do not guess between day-first and month-first when both numbers are 12 or less.
  3. Confirm the conversion, check several values against the original, then run COUNT again. Keep IDs and codes with meaningful leading zeros as text.

The Text Import settings explain how language and column type control this conversion. A correct-looking display is not enough: check the stored values and the resulting total before replacing your original data.

A small example you can check by hand

Create a sheet named Sales. Enter these headings and six records in A1:E7. The dates are shown in year-month-day order; make sure the Date cells are recognized as dates after entering or importing them.

Record IDDateRegionCategoryAmount
T012026-01-05NorthParts15
T022026-01-08NorthService5
T032026-02-03SouthParts20
T042026-02-11SouthService10
T052026-02-18NorthParts25
T062026-03-02SouthService15

Before building the pivot, =SUM(E2:E7) should give 90. =COUNT(E2:E7) should give 6 because all six amounts are numeric. If it gives fewer, correct the imported values before trusting the summary. Keep these check formulas outside A1:E7.

Build a region-by-category pivot table

  1. Select Sales.A1:E7, including the headings.
  2. Choose Insert → Pivot Table. In Select Source, choose Current selection and click OK. The menu-bar alternative is Data → Pivot Table → Insert or Edit.
  3. Drag Region from Available Fields to Row Fields.
  4. Drag Category to Column Fields.
  5. Drag Amount to Data Fields. Double-click that entry and select Sum if necessary.
  6. Expand Options and enable the totals row and totals column if you want both checks shown.
  7. Expand Source and Destination. Under Destination, choose New sheet, then click OK.
Pivot layout with Region in Row Fields, Category above Data in Column Fields, and Sum - Amount in Data Fields.
Put Region in rows, Category in columns and Amount in Data Fields. Keep Calc’s Data entry below Category. View this interface detail at full size.

The current pivot-table dialog reference documents these field areas and warns that an existing destination can be overwritten. Leave Record ID and Date unused for this first report. They will be useful for other calculations later.

Verify the result before changing the layout

Your report should contain these values; Calc may label the total row or column differently.

RegionPartsServiceTotal
North40545
South202545
Total603090

Check one intersection as well as the grand total. North/Parts is 15 + 25 = 40, and South/Service is 10 + 15 = 25. A grand total alone will not reveal that two region labels were assigned incorrectly.

To edit the report, right-click inside the pivot table and choose Properties. You can move a field to another area, drag an unwanted field back to Available Fields, or add another field. For example, putting Region and then Category in Row Fields creates a hierarchy of regions with categories underneath. Reversing their order changes which group contains the other.

Sum, Count, and Average answer different questions

Open Properties and double-click the entry in Data Fields to change its calculation. Do not rely on whichever function appeared when you first dragged the field.

Data Field function list with Sum selected for Amount, with Count and Average also visible.
Select Sum for total amounts. Count and Average answer different questions; check the field and function before trusting the result. View this interface detail at full size.
QuestionData field and calculationCheck on the six records
How much was sold?Amount, Sum90 overall
How many records are there?Record ID, Count; each record must have an ID6 overall; 3 in each region
What is the average recorded amount?Amount, Average15 overall; 90 divided by 6
How many numeric amounts are present?Amount, Count (Numbers only)6 when every amount is numeric

A count is not a distinct count of customers or orders. If an order occupies three line-item rows, counting its populated ID counts three entries. Decide what one source row represents before naming the report “Number of orders.”

For a one-column survey, drag the answer field to both Row Fields and Data Fields, then change the data calculation to Count. That puts answer categories down the side and frequencies beside them.

Count missing answers without losing the records

Use a populated Record ID as the Count field when every respondent must be included. Counting the optional answer itself can omit empty answers from the measure. For an explicit “No response” category, prepare a separate reporting column or a copy of the data that labels genuine blanks No response, and group by that field.

Do not turn on Identify categories to fill missing survey answers. That option assigns an unlabeled row to the category above it, as the layout options explain; it is meant for a different source structure. Keep the original answers intact so “missing” remains different from zero or a real response.

Refresh changed values—and extend the source for new rows

A pivot table is a report that must be refreshed after its underlying values change. Click inside its result and choose Data → Pivot Table → Refresh, or right-click and choose Refresh. The refresh instructions apply to changes in the source the pivot already uses.

Try two separate checks, each starting from the original six records:

  1. Edit an existing value. Change T01 from 15 to 18 in Sales.E2. Refresh. The grand total should become 93, with North/Parts at 43. Restore 15 and refresh before the next check.
  2. Add a record outside the old range. In row 8, enter T07, 2026-03-06, South, Service, 10. The original A1:E7 source does not include that row. Open Properties → Source and Destination and change the source Selection to include Sales.A1:E8, keeping the headings. Confirm the dialog, refresh, and check for a grand total of 100. South should now total 55 and Service 40.
Pivot Table source selection expanded to $Sales.$A$1:$E$8, with Selection selected and Named range unused.
Extend the source selection to include row 8 before updating the report.

For a growing list, a named range makes the source easier to identify, but its name does not prove it includes newly appended rows. Inspect the actual range after an import or append. Inserting rows inside an existing range can preserve the boundary more conveniently; still compare the last source row and the expected total. The Calc guide distinguishes changed records from an expanded data source.

Filter and sort the pivot report

Use the drop-down on a row or column field to choose which categories the pivot includes. With the original example, keeping only Parts should leave North 40, South 20, and a total of 60. Clear the filter to return to 90.

For a filter above the report, move a field into Filters in the layout. For example, move Region there and keep Category in Row Fields; selecting North should show Parts 40 and Service 5. A field in Filters narrows the report without adding another row or column grouping.

Filtering the original Sales sheet is a different action. An AutoFilter on the source does not restrict the pivot to just the rows visible on that sheet. Apply the condition in the pivot itself or build it from an explicitly prepared subset. This distinction is documented in the guide's filtering section.

To rank categories by value, open Properties, double-click the row field, and choose Options. Under Sort by, choose Descending and the Amount data field. Sorting by the category field instead sorts its labels. The same field-options dialog can show a chosen number of top or bottom items. Label a filtered top-five report clearly so its displayed total is not mistaken for the whole dataset.

Group real dates into months and years

For a monthly report, start with the original six records and an unfiltered pivot. Put Date in Row Fields and Sum of Amount in Data Fields. Remove other row or column fields if you want a simple month-by-month total.

  1. Click a date item in the pivot's result, rather than a date in the Sales source.
  2. Choose Data → Group and Outline → Group.
  3. In the date grouping dialog, select Months and Years, then confirm.
  4. Check January 20, February 55, March 15, and a grand total of 90.

Selecting both years and months keeps January from different years separated. The date-grouping instructions cover the available intervals, including quarters. Once a Years field exists, you can move it to Filters if you want a year selector above the report.

If Group is unavailable or you get ordinary text groups, check that you selected a date item in the pivot and that the source contains actual dates. A column of date-shaped text needs correcting before monthly grouping will work as intended. To remove a grouping, click within it and choose Data → Group and Outline → Ungroup.

Show percentages, averages, or an additional metric

To show each group's share, double-click its data field in Properties. In the Data Field dialog, click More if needed to reveal Displayed value. Choose % of total for a share of the report's overall result, % of row for a share within each row, or % of column for a share within each column. The displayed-value definitions describe these different denominators.

For the original example, North/Parts is 44.44% of the grand total because 40 ÷ 90 is about 0.4444. It is 88.89% of the North row because 40 ÷ 45 is about 0.8889. These are both valid answers to different questions. A changed filter also changes the report against which you are comparing.

Match the percentage to its measure. With Sum of Amount, North/Parts represents 40 of the total 90 in sales. With Count of Record ID, the same group has two of the six records, or 33.33% of the record count. A share of sales and a share of transactions answer different questions.

You can put the same source field in Data Fields again to show another calculation alongside it, such as Sum and Average. For a calculation needed on every transaction, add a clearly named helper column in the source and include it in the pivot's source range. Decide whether the question calls for a sum of row-level results or a calculation on group totals; an average of individual percentages is not automatically the overall percentage.

Calculated fields in LibreOffice 26.8 and later

LibreOffice 26.8 introduced calculated fields inside pivot tables. Click inside an existing pivot and choose Data → Pivot Table → Calculated Field. Give the field a Name and enter a Formula using the existing fields. Click Add, then confirm the dialog. The Calculated Field controls also let you modify or delete a definition.

Keep the source helper-column approach for calculations you need to inspect on each transaction, or when the workbook must work in a version before 26.8. Whichever approach you choose, check a group result and the grand total against the calculation you intended.

Inspect a total, format the report, and add a chart

Enable drill to details in the layout's Options to inspect the records behind a result. Double-click a numeric result to open its contributing records on a new sheet. For North/Parts 40, the contributing amounts in this example are 15 and 25. Double-clicking a category label is a different action: it can expand a breakdown or open the Show Detail selection.

For formatting you want to retain, modify the document's Pivot Table cell styles rather than repeatedly applying direct formatting. The current formatting reference says direct formatting can be lost after editing or refresh. It also distinguishes number formats, which come from the source, from other style properties. Refresh once after styling to check the finished report.

To create a pivot chart, click inside the pivot and choose Insert → Chart. Choose a chart type, add a useful title and labels, and finish the wizard. Start with a column or bar chart for comparing region or category totals. A linked pivot chart follows the pivot's layout and filters; refresh the table after source changes to update its data.

Reuse results without depending on a moving cell

A formula that points to one output cell can start reading another category after a layout change. GETPIVOTDATA retrieves a result using field and item names instead. If the region-by-category pivot is on a sheet named Pivot and A1 is inside its pivot area, this example retrieves North/Parts:

On a narrow screen, scroll this formula sideways to see the complete line. Copy it with its punctuation and spacing unchanged.

=GETPIVOTDATA("Amount";$Pivot.$A$1;"Region";"North";"Category";"Parts")

The expected result is 40 for the original data. Replace the sheet reference with a cell inside your actual pivot and keep the field names consistent. The GETPIVOTDATA reference explains that hidden or filtered-out results are not included; this is a reference to the report, not a separate unrestricted search of its raw data.

When the pivot result is wrong

SymptomFirst checkAction
You see 6 where you expected 90The calculation is CountOpen the data field and choose Sum for Amount.
Sum is too small, or some amounts act like zeroText amounts, a restricted source range, or a pivot filterCheck COUNT on the amounts, source boundaries, and every pivot filter; correct the source and refresh.
Total is twice the expected amountSource includes a total row or duplicate recordsRemove report totals from the source selection and investigate duplicate records before changing the calculation.
A new transaction never appearsThe appended row is outside SourceExtend the range, refresh, and check the expected increment.
There is an unexpected empty categoryMissing or inconsistent category labelsInspect the source records; do not assign them to the previous category unless that is what the data means.
Month grouping is unavailableA source cell or text label is selectedSelect a real date item inside the pivot; correct text dates in the source.
A formula next to the pivot reads the wrong groupOutput cells moved after a layout changeUse GETPIVOTDATA with the required field/item names.
The report lost its appearance after refreshFormatting was applied directlyUse the pivot cell styles for persistent formatting and check the number formats separately.

Keep an editable master and check the file you send

Keep an .ods master with its source records, pivot, and checks. If a recipient needs .xlsx, save a separate copy, reopen that exact copy, and check the layout, filters, grouping, formulas, chart, and a refresh. A visible total surviving conversion does not prove the recipient can refresh the report correctly. The Calc and Excel compatibility guide helps you decide which workbook features need that extra handoff check.

For a report the recipient only needs to read, a PDF can preserve the intended presentation; it does not carry an editable pivot workflow. To remove a pivot while keeping its source records, click inside the pivot and choose Data → Pivot Table → Delete. A chart linked to that pivot is removed with it, so keep a copy of a report you still need.

Filed under Calc