DateTime.IsInPreviousMinute

D

T

The M Code Behind the Power Query M function DateTime.IsInPreviousMinute

What is DateTime.IsInPreviousMinute Function?

The DateTime.IsInPreviousMinute function is a Power Query M function used to determine if a given date and time value falls in the previous minute relative to the current date and time. It takes a single argument, which is a datetime value that needs to be evaluated. The function returns a boolean value, which is true if the datetime value falls in the previous minute and false otherwise.

Syntax

The syntax for the DateTime.IsInPreviousMinute function is as follows:


DateTime.IsInPreviousMinute(dateTime as any) as logical


The function takes a single argument, dateTime, which can be any valid datetime value.

How Does the Function Work?

The DateTime.IsInPreviousMinute function works by comparing the given datetime value with the current datetime value. It calculates the time difference between the two values and checks if the difference is less than or equal to one minute. If the time difference is less than or equal to one minute, the function returns true; otherwise, it returns false.

Example

Suppose we have a datetime value of "2022-01-01 12:30:45". To check if this value falls in the previous minute, we can use the DateTime.IsInPreviousMinute function as follows:


DateTime.IsInPreviousMinute(#datetime(2022, 1, 1, 12, 30, 45))


This will return false because the datetime value is exactly on the minute, and the function checks if the value falls in the previous minute.

If we change the datetime value to "2022-01-01 12:29:45", the function will return true because the value falls in the previous minute relative to the current datetime value.

The DateTime.IsInPreviousMinute function is a useful function in Power Query that enables users to manipulate date and time data easily. It is used to determine if a given datetime value falls in the previous minute relative to the current datetime value. The function works by calculating the time difference between the two values and checking if the difference is less than or equal to one minute. When using this function, it is essential to understand the syntax and how it works to manipulate data effectively in Power Query.

Power Query and M Training Courses by G Com Solutions (0800 998 9248)

Upcoming Courses

Contact Us

    Subject

    Your Name (required)

    Company/Organisation

    Email (required)

    Telephone

    Training Course(s)

    Your Message

    Upload Example Document(s) (Zip multiple files)