Power Query DateTime.IsInCurrentMinute Function Guide
In this article
The DateTime.IsInCurrentMinute function in Power Query is a logical tool used to determine if a specific date and time value falls within the current clock minute of the system's current time. It returns a Boolean value—either TRUE or FALSE—making it ideal for creating dynamic filters that isolate records occurring right now, such as real-time system logs, live sensor data, or immediate transaction alerts. To use it, you simply pass a DateTime value into the function, and Power Query compares it against the current system time, ignoring seconds and milliseconds.
What You'll Need
- Microsoft Excel (with Power Query enabled) or Power BI Desktop.
- A dataset containing a column with the Date/Time data type.
- Access to the Power Query Editor (accessed via Data > Get Data or Transform Data).
Step-by-Step
- Load Your Data: Open your workbook or Power BI file and import your data source. Ensure the column you intend to check is explicitly set to the Date/Time data type. If the column is set to just "Date" or "Text," the function will return an error because it requires a precise timestamp to calculate the current minute.
- Open the Custom Column Dialog: In the Power Query Editor ribbon, navigate to the Add Column tab and select Custom Column. This opens a window where you can write a formula to create a new calculated column based on your existing data.
- Enter the Function: In the Custom Column formula box, give your column a name (e.g., "Is Current Minute"). In the formula area, type the following:
= DateTime.IsInCurrentMinute([YourColumnName]). Replace[YourColumnName]with the actual name of your date/time column by double-clicking it from the available columns list on the right. - Verify the Data Type: Once you click OK, Power Query will generate a new column filled with
TRUEorFALSE. Click the data type icon (usuallyabc/123) in the column header and select True/False to ensure the column is correctly typed as a logical Boolean. - Filter the Results: To isolate only the records from the current minute, click the filter dropdown arrow in the header of your new "Is Current Minute" column and uncheck
FALSE. This leaves only the rows where the timestamp matches the current system minute. - Remove the Helper Column: If you only needed the column for filtering purposes and do not want it in your final report, right-click the "Is Current Minute" column header and select Remove. Because Power Query records these steps in the Applied Steps pane, the filter will remain active even after the helper column is removed from the final view.
- Apply Changes: Click Close & Apply (Power BI) or Close & Load (Excel) to bring the filtered, real-time data into your spreadsheet or report model.
Common Mistakes
One of the most frequent errors is attempting to use this function on a column that is formatted as a Date rather than a DateTime. A Date column lacks the hour and minute components, causing the function to fail or return unexpected results. Always check the icon next to the column header to confirm it shows the small calendar and clock symbol.
Another common mistake is forgetting that DateTime.IsInCurrentMinute relies on the system time of the machine performing the refresh. If your data is coming from a server in a different time zone (e.g., UTC) but your local machine is set to EST, the function will compare the UTC timestamp to the EST system clock. This often results in all rows returning FALSE, even if the events are happening "now" in the server's time zone.
Users also frequently confuse this function with DateTime.LocalNow(). While DateTime.LocalNow() provides the current timestamp, DateTime.IsInCurrentMinute is a logic check (a predicate) that returns a yes/no answer. You do not need to nest LocalNow inside IsInCurrentMinute; the function handles the current time check internally.
Tips
To handle the time zone issue mentioned previously, you can adjust your timestamp column to match your local time before applying the function. Use the Transform > Date/Time > Local Time options or add a custom step to add/subtract the necessary hours using #duration(hours, 0, 0, 0).
For more flexibility, consider using this function in a Conditional Column. Instead of just a TRUE/FALSE result, you can use the logic to assign a label, such as "Real-Time" for TRUE and "Historical" for FALSE. This allows you to keep all data in your model while still being able to slice your visuals by the timing of the event.
If you are building a dashboard that needs to update constantly, remember that Power Query is not a "streaming" service. The DateTime.IsInCurrentMinute function only updates when the data is refreshed. To make this truly effective, set your data refresh interval to the shortest possible time allowed by your environment (e.g., every 15 minutes in Power BI Service or via a VBA macro in Excel) to ensure the "current minute" is actually current.
Troubleshooting
If the function is returning FALSE for every single row despite knowing that current data exists, first check your system clock. Ensure your computer's date, time, and time zone are synchronized. If the system clock is off by even one minute, the function will not find a match.
If you encounter a Formula.Fx error, check the syntax of your column reference. Ensure the column name is enclosed in square brackets [] and that there are no typos. Power Query is case-sensitive, so datetime.isincurrentminute (lowercase) will not work; it must be DateTime.IsInCurrentMinute.
If the data type is correct but you still see no results, try creating a temporary column using DateTime.LocalNow(). Compare this value side-by-side with your data column. If the hours or dates differ, you have a time zone mismatch. You will need to use DateTimeZone.SwitchZone or a similar function to align the data with your local system time before the IsInCurrentMinute check can succeed.
Frequently Asked Questions
Does this function include the seconds of the current minute?
Yes. The function checks if the date and time fall anywhere between second 0 and second 59 of the current system minute. It does not require the seconds to match exactly; it only requires the year, month, day, hour, and minute to be identical to the current system time.
Can I use this for the current hour instead?
Yes, Power Query provides a similar function called DateTime.IsInCurrentHour. It works identically to the current minute function but returns TRUE for any timestamp that falls within the current 60-minute block of the current hour.
Will this function work in a Power BI scheduled refresh?
Yes, but it will use the time zone of the Power BI Service (which is typically UTC) rather than your local desktop time. To fix this, you should convert your timestamps to UTC or use a custom Power Query formula to offset the time to your specific region before calling the function.
Is there a performance impact when using this on large datasets?
Because this function is calculated row-by-row during the refresh process, it can slow down very large datasets (millions of rows). To optimize, try to filter your data by date or hour first using a more efficient filter, then apply the IsInCurrentMinute check to the smaller resulting subset.
Can I use this function in a DAX calculated column instead?
No, DateTime.IsInCurrentMinute is a Power Query (M language) function. To achieve the same result in DAX, you would need to write a formula comparing the NOW() function with your column, using TRUNC or FORMAT to strip the seconds from both values for comparison.