Sub topic 9
Slice by date and period
This chapter assumes you have a flat Data table, a first slicer, and a basic idea of filtering by values or by condition from the earlier chapters. You should also know how to edit a pivot table and write simple formulas. Here you will learn how to let viewers filter the dashboard by date and by period (month, quarter, year), and how to avoid the errors that come from dates stored as text.
Why dates need their own treatment
A date column is the one most viewers want to filter. It is also the column where a slicer is least convenient by default. A slicer set to "Filter by values" on Order Date lists every distinct date. A year of daily orders gives you 365 checkboxes, which nobody wants to click.
You have two ways to make date filtering usable:
- Use Filter by condition on the date column, for example "Date is between" two dates.
- Add helper columns such as Month, Quarter, and Year to the source table, then put a values slicer on each one. A few short checkbox lists replace hundreds of dates.
Most dashboards use both. The condition slicer handles custom ranges. The helper-column slicers handle quick period choices.
Step 1: Confirm the dates are real dates
A slicer's date conditions only work on true date values. A cell that looks like a date but is stored as text is ignored by "Date is between", and pivot tables will not group it.
Real dates are right-aligned by default and are stored as numbers. Text is left-aligned. To count the problem rows, use this formula in any spare cell:
=COUNTA(Data!B2:B) - COUNT(Data!B2:B)COUNTA counts all non-empty cells and COUNT counts only numeric ones, which includes dates. A result above 0 means some Order Date cells are text.
To convert a text column, you can use DATEVALUE in a scratch column and then paste the results as values over the originals:
=ARRAYFORMULA(IF(Data!B2:B = "", "", DATEVALUE(Data!B2:B)))Then apply a date format with Format > Number > Date.
Step 2: Add a condition slicer on Order Date
Create a slicer as you did in the earlier chapter, with the data range covering your whole table and the column set to Order Date. Then:
- Open the slicer's filter menu and choose Filter by condition.
- Pick a date condition from the list.
- Enter a date or choose a relative option, then select OK.
The date conditions are:
| Condition | Use it for |
|---|---|
| Date is | One specific day |
| Date is before | Everything earlier than a date |
| Date is on or before | Everything up to and including a date |
| Date is after | Everything later than a date |
| Date is on or after | A start date, inclusive |
| Date is between | A closed range with two dates |
| Date is not between | Excluding a range, such as a freeze period |
The "Date is" family also offers relative choices such as today, yesterday, in the past week, in the past month, and in the past year. A relative choice is evaluated against the current date, so the filter moves forward as time passes. An exact date stays fixed until someone changes it.
A viewer who wants a custom range has to edit the condition each time. That works for analysts but is awkward for a casual audience. For them, add the helper-column slicers below.
Step 3: Add period helper columns
Add three columns to the right of Revenue so the table stays flat. The headers go in G1, H1, and I1. The sample table then looks like this:
Sheet name: Data
A1:I1 headers: Order ID | Order Date | Region | Category | Units | Revenue | Year | Quarter | Month
A2: 1001 | 2026-01-05 | West | Hardware | 3 | 450.00 | 2026 | 2026-Q1 | 2026-01
A3: 1002 | 2026-01-09 | East | Software | 1 | 120.00 | 2026 | 2026-Q1 | 2026-01
A4: 1003 | 2026-02-02 | East | Hardware | 2 | 300.00 | 2026 | 2026-Q1 | 2026-02You could fill formulas down by hand, but new rows would need them copied. A single ARRAYFORMULA in each column fills itself. Place each of these in row 2 of its column:
G2: =ARRAYFORMULA(IF(B2:B = "", "", YEAR(B2:B)))
H2: =ARRAYFORMULA(IF(B2:B = "", "", YEAR(B2:B) & "-Q" & ROUNDUP(MONTH(B2:B) / 3, 0)))
I2: =ARRAYFORMULA(IF(B2:B = "", "", TEXT(B2:B, "yyyy-mm")))Notes on these choices:
- The labels use year first (
2026-Q1,2026-01) so they sort correctly as text. A label likeJanwould sort alphabetically, with April before January. - The
IF(B2:B = "", "", ...)guard keeps empty rows empty. Without it, blank rows would produce 1900-based values and appear in your slicer list. - An
ARRAYFORMULAfills the cells below it. If any of those cells already contains data, the formula returns a#REF!error. Clear those cells first.
Step 4: Slice on the helper columns
Create one slicer for each helper column you want to expose, for example Year and Quarter. Each slicer uses the default Filter by values option, which shows a short checklist:
- Year shows 2026, plus earlier years if the data has them.
- Quarter shows 2026-Q1 to 2026-Q4.
- Month shows up to twelve entries per year.
Viewers can combine slicers. If Year is set to 2026 and Quarter to 2026-Q1, the dashboard shows only rows that match both. The result is the intersection of the filters, so contradictory choices (Year 2025 with Quarter 2026-Q1) leave no rows at all.
Keep the number of date slicers small. A Year slicer and a Month slicer are enough for most dashboards. More slicers take up space and make it likely a viewer sets conflicting filters.
How date slicers interact with pivot tables
A slicer filters the rows of the source data range. A connected pivot table then summarises only the rows that remain. This means two separate date mechanisms exist, and they do different jobs:
- The slicer decides which rows are included.
- The pivot table's own grouping decides how the dates are shown. You can set a row field on Order Date and choose a grouping such as Year-Month, Quarter, or Year-Month-Day, using right-click > Create pivot date group.
So a month-by-month revenue chart can sit on a pivot table grouped by Year-Month, and a Year slicer can still narrow it to 2026. For the slicer to reach the pivot table and chart, they must be connected to it in the slicer's Customize > Connect to charts menu, as covered in the previous chapter.
KPI cells and date slicers
Your SUBTOTAL KPI cells from the earlier chapter follow date slicers automatically. A date slicer hides rows in the source table, and SUBTOTAL(109, ...) leaves hidden rows out.
=SUBTOTAL(109, Data!F2:F1000)Be aware of two limits:
- The range must cover the rows you want to count. If the data grows past row 1000, the KPI silently ignores the new rows. Use a larger range, or an open-ended range like
Data!F2:Fif your layout allows it. QUERYformulas read all the data and ignore the hidden-row state. AQUERYsummary on the dashboard will not change when a viewer moves a date slicer. Use a pivot table connected to the slicer when you need a summary that responds.
Common errors with date slicers
| Symptom | Likely cause | Fix |
|---|---|---|
| "Date is between" returns nothing | Dates are stored as text | Convert with `DATEVALUE` and apply a date format |
| Slicer list shows 1899 or 1900 dates | Formulas produce a date from empty cells | Add an `IF(B2:B = "", "", ...)` guard |
| New Month column is not in the slicer | Data range was set before the column was added | Edit the slicer's data range to include it |
| Slicer changes the table but not a chart | Chart is not connected to that slicer | Connect it through Customize |
| Months sort as Apr, Aug, Dec | Labels are month names | Use `yyyy-mm` labels |
| Last day of the range is missing | Order Date has a time part, for example 2026-03-31 14:20 | Test the boundary, or use "Date is before" with the next day |
| Relative filter shows different results next week | It is evaluated against today's date | Use an exact date if the report must stay fixed |
Practice
Exercise
Your Month helper column uses the labels Jan, Feb, Mar and so on. In the slicer, April appears before January. Why, and what formula would fix it for a date in B2?
Show answer
The slicer sorts the text labels alphabetically, so "Apr" comes before "Jan". Use year-first numeric labels, for example =TEXT(B2, "yyyy-mm"), which gives 2026-01 and sorts in calendar order.
Exercise
A "Date is between" slicer on Order Date shows no rows, even though the table clearly has orders in that range. Name a check you can run and the formula that does it.
Show answer
The dates are probably text. Run =COUNTA(Data!B2:B) - COUNT(Data!B2:B). A result above 0 means some Order Date cells are not real dates. Convert them with DATEVALUE and apply a date format.
Exercise
A KPI cell uses =QUERY(Data!A1:I, "select sum(F)", 1). A viewer sets the Year slicer to 2026, but the KPI does not change. Why, and how would you change the KPI?
Show answer
QUERY reads all the data and ignores rows hidden by a slicer. Replace it with =SUBTOTAL(109, Data!F2:F1000), which leaves out hidden rows, or read the figure from a pivot table that is connected to the slicer.