Date.IsInCurrentDay is a Power Query M function that indicates whether the given date(time) value occurs during the current 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.IsInCurrentDay( dateTime as any ) as nullable logical
Description
Date.IsInCurrentDay evaluates if a given value (of date, datetime, or datetimezone) corresponds to the current day based on the system’s date and time.
Examples
Let’s look at two simple examples to understand how this function works.
Checking Today’s Date in a Calendar Table
Suppose you have a calendar table and want to add a column that shows true
for today’s date. You can do this with the Date.IsInCurrentDay
function applied to your [Date]
column.
Date.IsInCurrentDay( [Date] ) // Output depends on [date] column
This expression will return true
for any date in the [Date]
column that matches today’s date.
For example, if today is July 5, 2024, this function will mark true
for all rows with the date July 5, 2024. Here’s a screenshot taken on July 5, 2024 where the Day Offset is 0:
You can see that July 5, 2024 is marked with true
for the current day.
Checking the Current Date and Time
You can also use Date.IsInCurrentDay
to check if the current date and time is today. This can be done using the DateTime.FixedLocalNow function, which gets the current date and time.
// Output: true
Date.IsInCurrentDay( DateTime.FixedLocalNow() )
Here, DateTime.FixedLocalNow() gets the current date and time. The Date.IsInCurrentDay function then checks if this date and time is today, which will always be true
.
Related functions
Other functions related to Date.IsInCurrentDay are:
2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy