Date.AddQuarters Function in Power Query
The Date.AddQuarters function returns a Date/DateTime/DateTimeZone value incremented by the number of quarters provided. Each quarter is defined as a duration of three months. It also handles incrementing the year potion of the value as appropriate.
Syntax
Date.AddQuarters(dateTime as any, numberOfQuarters as number) as any
Example:
Power Query M
let Source = Table.FromRecords( { [Year = "20-07-2024"], [Year = "21-07-2024"], [Year = "22-07-2024"], [Year = "23-07-2024"], [Year = "24-07-2024"], [Year = "25-07-2024"], [Year = "26-07-2024"], [Year = "27-07-2024"], [Year = "28-07-2024"], [Year = "29-07-2024"], [Year = "30-07-2024"], [Year = "31-07-2024"], [Year = "01-08-2024"], [Year = "02-08-2024"], [Year = "03-08-2024"], [Year = "04-08-2024"], [Year = "05-08-2024"], [Year = "06-08-2024"] } ), // Convert the "Year" column from text to date format Converted = Table.TransformColumnTypes(Source, {{"Year", type date}}), // Modify the "Year" column directly by adding 1 year to each date return = Table.TransformColumns(Converted, {{"Year", each Date.AddQuarters(_, 2), type date}}) in return
The output of the above code is shown below: