Power Query Date.AddQuarters: How to Add Quarters to Dates
In this article
Date.AddQuarters adds a whole number of quarters to a date, datetime, or datetimezone value and returns the new date. The syntax is Date.AddQuarters(dateTime, numberOfQuarters), where a positive number moves forward and a negative number moves backward. It is a built-in Power Query M function, so no add-in or custom code is required.
What You'll Need
- Power Query available in Excel, Power BI Desktop, or another host that supports M. Menu labels can differ slightly by version, device, or region.
- A column or value that Power Query recognises as a date, datetime, or datetimezone. Text dates must be converted first.
- A whole number for the quarter offset. Decimals are truncated, and null inputs return null.
Step-by-Step
- Load your data into Power Query. In Excel, select your table and choose Data > From Table/Range. In Power BI Desktop, choose Home > Transform data to open the Power Query Editor.
- Check the date column's data type. Select the column header and confirm it shows Date, Date/Time, or Date/Time/Zone. If it shows Text or Any, use Transform > Data Type and pick the correct type before going further.
- Add a custom column. On the Add Column tab, choose Custom Column.
- In the formula box, enter a call such as
Date.AddQuarters([OrderDate], 1). Replace[OrderDate]with your actual column name and1with the number of quarters to add. - Name the new column, for example NextQuarter, and click OK. Power Query evaluates the formula row by row.
- Set the new column's data type to Date. Use the icon in the new column header or Transform > Data Type. Without this step the column may stay as Any.
- For a fixed offset, you can also use the formula bar directly. Select an existing column, then edit the formula in the formula bar to wrap the column reference in
Date.AddQuarters(..., n). - To subtract quarters, use a negative number, for example
Date.AddQuarters([OrderDate], -2). Do not use a minus sign in front of the function name. - To base the offset on another column, reference both columns, for example
Date.AddQuarters([OrderDate], [QuarterOffset]). Ensure QuarterOffset is a whole number type. - Apply the changes with Home > Close & Load (Excel) or Home > Close & Apply (Power BI). The new column is written to the data model or worksheet.
Common Mistakes
- Using text dates. Date.AddQuarters expects a date value. If the column is Text, the formula returns an error. Convert the type first, and check for locale-specific formats that fail to parse.
- Passing a decimal. The function truncates fractional values, so 1.9 behaves like 1. Round or use Number.Round first if that matters.
- Using a column name that does not exist. M is case-sensitive.
[orderdate]is not the same as[OrderDate], and a misspelled name produces an error in every row. - Forgetting the data type step. The new column may appear as Any and fail in later steps or visuals.
- Expecting an end-of-quarter date. Date.AddQuarters keeps the same day-of-month where possible. Adding one quarter to 31 January gives 30 April because April has 30 days, not 31.
- Assuming nulls are skipped. Null dates return null, which is correct but can look like a missing result.
Tips
- Use Date.AddQuarters for quarter offsets and Date.AddMonths with 3 for the same effect. Both are valid; choose one for consistency.
- To get the start of the quarter after adding, wrap the result in
Date.StartOfQuarter(...). To get the end, useDate.EndOfQuarter(...). - For fiscal quarters, add an offset that matches your fiscal year start, then use Date.QuarterOfYear for labels.
- Add an index or a reference column before the custom column if you want to compare the original and shifted dates side by side.
- Keep offsets in a separate column rather than hard-coding numbers, so you can change the shift without editing the formula.
- Test on a small query first, especially when the date column contains mixed formats or nulls.
Troubleshooting
If the custom column shows errors, select the error cell to see the message. The most common causes are a text date column, a misspelled column name, or a non-numeric offset. Fix the data type first, then check the exact column name in the formula.
If the formula is rejected before you click OK, check the parentheses and the comma. The function takes exactly two arguments: the date value and the number of quarters.
If results look off by a few days, remember that month lengths differ. Adding a quarter to 30 November gives 28 or 29 February, not 30 February. If you need the last day of the target quarter, use Date.EndOfQuarter instead.
If the column is empty after loading, confirm the custom column was added before the final step and that the query was not reordered. In Power Query, steps run in order, so a later step can overwrite or remove the column.
If the function is not recognised, check that you are in Power Query and not in a DAX formula bar. Date.AddQuarters is an M function, not a DAX function. In DAX, use EDATE or DATEADD with a quarter interval instead.
Frequently Asked Questions
Does Date.AddQuarters work on datetime values?
Yes. It accepts date, datetime, and datetimezone values and returns the same type with the date shifted by the number of quarters.
What happens if I pass a negative number?
The date moves backward by that many quarters. For example, Date.AddQuarters(#date(2024, 5, 15), -1) returns 15 February 2024.
Can I add quarters to a text date?
No. Convert the text to a date type first, for example with Date.FromText, then apply Date.AddQuarters.
Does it always keep the same day of the month?
It keeps the day where the target month has that day. Otherwise it returns the last valid day of the month, such as 30 April for a 31 January input plus one quarter.
Is there a Date.AddQuarters equivalent in DAX?
DAX does not have a direct function with that name. Use EDATE with a multiple of 3 months, or DATEADD with the Quarter interval, depending on your model.
What does it return for a null date?
Null. The function propagates nulls rather than raising an error, so null rows stay null in the new column.