Date.IsInNextYear

Updated on

Date.IsInNextYear is a Power Query M function that indicates whether the given date(time) value occurs during the next year, as determined by the system. The function returns a boolean value (true or false).

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

Date.IsInNextYear( dateTime as any ) as nullable logical

Description

Date.IsInNextYear test if a given value (of type date, datetime, or datetimezone) is in the next year relative to the current system date and time, excluding the current year.

Examples

Let’s explore two straightforward examples to understand how the Date.IsInNextYear function works.

Checking for Dates within the Next Year

Let’s say you have a calendar table and you want to add a column that shows true for dates that are in the next year. You can do this using the Date.IsInNextYear function on your [Date] column.

Date.IsInNextYear( [Date] ) // Output depends on [Date] column

This expression returns true for any date in the [Date] column that falls within the next year.

For example, if today is July 6, 2024, this function will return true for all rows with dates between January 1, 2025, and December 31, 2025. Here’s a screenshot showing this:

Example on how to use the Date.IsInNextYear function in Power Query_M

You can see that dates within the next year are marked with true.

Using the Current Date and Time

To test if the year following the current system time falls within the next year, you can use the following expression:

// Output: true
Date.IsInNextYear( Date.AddYears( DateTime.FixedLocalNow(), 1 ) )

Other functions related to Date.IsInNextYear are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/date-isinnextyear

2023-2026 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy