Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Power Query Date.IsInNextQuarter Function Guide

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

The Date.IsInNextQuarter function in Power Query evaluates whether a given date falls within the quarter *after* the current quarter, returning true or false. It requires only a valid date value—no additional setup is needed beyond having the Power Query editor open in Excel or Power BI. This function is especially useful for dynamic filtering of upcoming data (e.g., forecasting, budget planning) without hardcoding date ranges.

What You'll Need

  • Excel (2016 or later) or Power BI Desktop (latest version)
  • A table or query containing a date column (e.g., OrderDate, ShipDate)
  • Access to the Power Query Editor (via Data > Get Data > Launch Power Query Editor in Excel, or Get Data > Transform Data in Power BI)

Step-by-Step

  1. Open Power Query Editor: In Excel, go to the Data tab and click Get Data > Launch Power Query Editor. In Power BI, click Home > Transform Data. Ensure your data table is loaded and visible in the left-hand Queries pane.
  2. Select the date column: Click the header of your date column (e.g., OrderDate) to highlight it. Do not filter or sort yet—this step works on the full column.
  3. Add a custom column: Go to the Add Column tab, then click Custom Column. This opens the Custom Column dialog box.
  4. Enter the formula: In the Custom column name field, type a descriptive name like IsNextQuarter. In the Custom column formula field, enter: Date.IsInNextQuarter([OrderDate]). Replace [OrderDate] with your actual column name (include the square brackets).
  5. Confirm and apply: Click OK. Power Query evaluates the function for each row, populating the new column with true or false based on whether the date falls in the *next* quarter relative to today’s date (e.g., if today is May 15, 2024—Q2—the next quarter is Q3, July 1–September 30).
  6. Filter for next-quarter dates (optional but common): Click the filter icon ( funnel) at the top of your new IsNextQuarter column. Select only true, then click OK. This leaves only rows where the date is in the upcoming quarter.
  7. Close & Load: Click Close & Load (Excel) or Close & Apply (Power BI) to push the filtered or enriched data back to your worksheet or report model.

Common Mistakes

  • Using local time zones incorrectly: Power Query uses the system’s current date and time zone settings. If your data is in UTC or another time zone, today’s quarter might differ from your intended reference. Always verify the system clock and time zone in Windows Settings > Time & Language > Date & Time.
  • Confusing quarter definitions: Power Query defines quarters as Jan–Mar (Q1), Apr–Jun (Q2), Jul–Sep (Q3), Oct–Dec (Q4). Date.IsInNextQuarter calculates *relative to today*, not a fixed reference like the current row’s quarter. It does not compare to another column—it only checks against the *current* system quarter.
  • Missing or invalid date values: If your date column contains text (e.g., "2024-07-01" instead of a proper date type), the function returns an error or false. Ensure the column is set to Date or DateTime type (right-click column > Change Type).
  • Assuming it’s relative to another date: This function *only* uses today’s date. To compare to a different reference date (e.g., a fiscal year start), you must build a custom logic formula (see Tips).

Tips

  • Combine with Date.QuarterOfYear for debugging: Add a helper column using Date.QuarterOfYear([OrderDate]) to see which quarter each date belongs to, then manually verify against the system quarter (e.g., if Date.QuarterOfYear(#datetime(2024, 5, 15, 0, 0, 0)) returns 2, the next quarter is 3).
  • Handle time components: If your dates include time (e.g., 2024-09-30 23:59), the function still works correctly—quarters are date-based, not time-based. But be aware that 23:59:59 on the last day of Q2 is still Q2, not Q3.
  • Use in conditional logic : Instead of filtering, you can use this in a Table.SelectRows call or if statement for dynamic visuals (e.g., ).
  • Fiscal year adjustments: If your fiscal year starts in July (not January), use Date.IsInNextQuarter *after* shifting dates. Example: Create a column ShiftedDate = Date.AddYears([OrderDate], 0) (no shift needed for July start), then define a custom quarter function or use Date.IsInNextQuarter(Date.AddMonths([OrderDate], 0)) only if your system date aligns with fiscal quarters.
  • Test with DateTime.LocalNow() explicitly: In the formula bar, try Date.IsInNextQuarter(#datetime(2024, 10, 1, 0, 0, 0)) to simulate future dates. This helps verify behavior before applying to real data.

Troubleshooting

  • Error: "Expression.Error: The name 'Date.IsInNextQuarter' wasn't recognized" : This usually means you’re using an older version of Power Query (pre-Excel 2019 / Power BI Desktop before May 2020). Update to the latest version. As a workaround, use custom logic: .
  • Always returns false: Check if your system date is correct. Open the formula bar and type DateTime.LocalNow()—does it show today’s date? If your PC clock is off (e.g., set to last year), the function uses that incorrect date. Fix the system time and refresh.
  • Column shows errors like "We couldn't convert to Date": Your input column is not a native date type. Right-click the column > Change Type > select Date or DateTime. If the data is text (e.g., "Q3 2024"), parse it first using Transform > Split Column or General Date conversion.
  • Unexpected results near quarter boundaries: For example, a date like September 30 might be treated as Q3, but if the system quarter has already advanced (e.g., today is October 1), it correctly returns false. Verify with Date.QuarterOfYear as described in Tips.

Frequently Asked Questions

Does Date.IsInNextQuarter work with fiscal quarters?

No. It strictly follows the calendar year (Q1 = Jan–Mar). For fiscal years starting in July, October, etc., you must build a custom quarter calculation first (e.g., by adjusting months) and then compare quarters.

Is the function case-sensitive or locale-dependent?

The function name itself is case-insensitive in Power Query (so date.isinnextquarter works), but the underlying date interpretation depends on your system locale (e.g., MM/DD vs DD/MM). Use Date.From with explicit formats if needed.

Can I use this to compare against a different quarter (e.g., next quarter after a specific date in my data)?

No. The function only compares to *today’s* quarter. To compare to, say, the quarter after a StartDate, calculate the target quarter manually: Date.QuarterOfYear(Date.AddMonths([StartDate], 3)).

Why does my filtered table still include dates from the current quarter?

If you applied the filter *before* updating the system date, Power Query cached the old result. Click Home > Refresh to re-evaluate Date.IsInNextQuarter with the current system date.

Does this work in DirectQuery mode in Power BI?

Yes, but only if the underlying data source supports the M function translation (e.g., SQL Server, Azure Synapse). In some databases, it may fallback to client-side evaluation. Test with a small dataset first.

What happens on leap years or year transitions?

None. Quarters are strictly 3-month blocks. December 31 is always Q4, regardless of leap years or year-end transitions. The function handles this automatically.