HomeGoogle DocsSpreadsheetDrill Down in Pivot Table in Google Sheets (Date Field)

Drill Down in Pivot Table in Google Sheets (Date Field)

Published on

This post describes drilling down a pivot table date column (field) in Google Sheets to get additional levels of detail.

For example, consider your credit card or bank statement for the last two financial years. You want a yearly, quarterly, and monthly summary view of it.

You don’t require to add a year, quarter, or month column to your data or create three pivot table reports for date field data hierarchies.

The existing date column in your credit card statement is sufficient.

The Pivot table can do the grouping with additional levels without adding a year, quarter, or month column in your source data.

Let’s see how to drill-down and drill-up a date column in the Pivot table in Google Sheets.

Thanks to Shay for sharing this tip with me.

Drill Down a Date Column in Pivot Table: Year > Quarter > Month

I am using the following mockup sales data as a sample to create our report.

You don’t require to use this sales data. You can use your available data (copy) for the purpose. But the data must contain the date and amount columns.

That will be enough to drill-down date field in the Pivot table in Google Sheets.

Sample Data in A3:F13 Range

There are a total of three main steps involved in this.

  1. Creating a Pivot table.
  2. Defining Dimension Hierarchy.
  3. Drill-down date column as per the data hierarchy in the Pivot table.

1. Creating a Pivot Table

Select your data range, i.e., A3:F13, and go to the Insert menu and select Pivot table.

Check “New Sheet” and click the “Create” button on the pop-up that appears.

Add “Date” to the Rows field, “Description” to the Columns field (optional), and “Qty. (MT)” to the Values field.

Initial Report Settings

The above settings will create a Pivot table with dates row-wise and descriptions in columns. It sums the quantities as below.

Report Based on A3:F13 Range

There is no option to drill-down the date column in the above Pivot table in Google Sheets.

It’s not necessary, though. Because the dates in this report are already in the lower level of the hierarchy.

Grouping the date column is essential to enable drill-down detail in Pivot Table in Google Sheets. How to do that?

2. Defining Dimension Hierarchy

First, decide the order of the levels of the hierarchy. In the example, I will follow Year > Quarter > Month. We will define that while grouping dates.

Other proposed levels are Year > Month, Quarter > Month, and Month > Day of the week.

We are creating a three-level drill-down. So we will have a year column, a quarter column, and a month column in our report.

So we should first group the dates by year, then by quarter, and finally by month.

3. Drill Down Date Column as per Dimension Hierarchy in the Pivot Table

The first thing we should do on the Pivot table is group the date column by year.

I’ve already written two detailed tutorials on this.

You can skip reading them right now.

Right-click on any date and select Create pivot date group > Year. Please see the image below.

Drill Down Date in Pivot Table - Year

Then open the Pivot table editor. How?

You can open it by hovering your mouse pointer over the Pivot table and clicking on the Edit button that appears at the bottom of the table.

Under the Rows field, add Date.

It will instantly add a new date column in your Pivot table report.

Right-click any date on that column, and choose Create pivot date group > Quarter.

Drill Down Date in Pivot Table - Quarter

Repeat the last step once again. I mean to say, add Date to the Rows field within the Pivot table editor.

Right-click on any date and select Create pivot date group > Month.

The output will be as follows.

Drill Down Date in Pivot Table - Month

You can now drill-down or drill-up the date column in your Google Sheets Pivot Table.

If you want, you can add one more level. That’s to show the Day of the week. But I’ve omitted that in my example.

To test the drill-down detail in Pivot Table, please do as follows;

Click the minus to collapse the group and the plus (that subsequently appears) to expand the group. That’s all.

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

Running Total By Month in Excel

This tutorial demonstrates how to calculate the running total by month in a range...

SORT and SORTBY – Excel Vs Google Sheets

While Excel offers the SORT and SORTBY functions for sorting a table, Google Sheets...

Get Top N Values Using Excel’s FILTER Function

When using the FILTER function in Excel to extract the top N values, it's...

More like this

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

Google Sheets Bar and Column Chart with Target Coloring

To color each data point in the column or bar chart according to the...

2 COMMENTS

  1. I follow your posts on google sheets regularly and also a subscriber of your blog. I have an interesting problem/challenge for you that could be a topic for your post also.

    Kindly go through a post http://www.contextures.com/xlPivot-Filter-Source-Data.html. It provides a code for excel pivot table by which double-clicking opens the data source with filters showing just the rows that make the value for the double-clicked cell.

    I find this feature very very useful and has been looking for a script for Google Sheets. But did not have any luck so far.

    There is a data drill feature in Google Sheets pivot that throws such rows but only on a new Sheet, not the filtered data source that I am looking for.

    I feel there should be some way to replicate the code in the above post for google sheet also or maybe some round-about way.

    After a lot of searching, I feel you are the only person who can probably help. Request you to kindly write a post on this problem and provide some solution.

    • Hi, S K Srivastava,

      When you double click on any aggregated values in Sheets Pivot Table, Google Sheets open a new tab to show the details associated with it. I understand you do not like this feature and want the details within the Pivot Table Sheet tab.

      For this, I can only think about a formula based workaround as I’m not familiar with Apps Script. One thing I can recommend you is using a Query.

      =query(A3:B,"Select * where A='"&E3&"'")

      Details from Pivot Table with the help of Query

      Change E3 in the formula.

      If you may not like such a solution you might find lucky asking your question on the Google Community Forum.

      https://support.google.com/docs/threads?hl=en&thread_filter=(category:docs_sheets)

      Please post your question there. There are lots of contributors who can help you with this.

      You can also find me there 😀

      Best,

      Prashanth KV

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.