Date.IsInNextDay

Updated on

Date.IsInNextDay is a Power Query M function that indicates whether the given date(time) value occurs during the next day, 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.IsInNextDay( dateTime as any ) as nullable logical

Description

Date.IsInNextDay assesses whether a given value (of type date, datetime, or datetimezone) is on the day following the current system date and time.

Examples

Let’s look at two simple examples to understand how this function works.

Checking for Tomorrow’s Date in a Calendar Table

Suppose you have a calendar table and want to add a column that shows true for dates that are in the next day. You can do this with the Date.IsInNextDay function applied to your [Date] column.

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

This expression will return true for any date in the [Date] column that matches tomorrow’s date.

For example, if today is July 6, 2024, this function will mark true for all rows with the date July 7, 2024. Here’s a screenshot taken on July 6, 2024 where the Day Offset is 0:

How to use the Date.IsInNextDay Function in Power Query M

You can see that July 7, 2024 is marked with true for the next day.

Using the Current Date and Time

You can also use Date.IsInNextDay to check if the current date and time falls into tomorrow. This can be done using the DateTime.FixedLocalNow function together with Date.AddDays. The following expressions shift today’s datetime value to the next day:

// Output: true
Date.IsInNextDay( Date.AddDays( DateTime.FixedLocalNow(), 1 ) )

Here, DateTime.FixedLocalNow gets the current date and time. Date.AddDays then shifts this value forward one day. The Date.IsInNextDay function then checks if this date and time falls into tomorrow, which will always be true when the function checks tomorrow’s date.

Other functions related to Date.IsInNextDay are:

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

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