Power Query Today's Date: How to Add It to Your Data
In this article
Adding today’s date in Power Query is a common requirement when preparing reports, logs, or automated data extracts. It ensures your data always reflects the current day without manual updates. This is achieved using Power Query’s built-in date functions, no external tools or add-ins needed. You only need Microsoft Excel (2016 or later) or Microsoft Power BI Desktop installed.
What You'll Need
- Microsoft Excel 2016 or later (including Microsoft 365)
- Or Microsoft Power BI Desktop (free download)
- A data source already loaded into Power Query (Excel table, CSV, database, etc.)
- Basic familiarity with the Power Query Editor interface
Step-by-Step
- Open your Excel workbook or Power BI Desktop file containing the data you want to modify.
- Select any cell within your data table or dataset, then go to the Data tab and click Get Data > From Table/Range (in Excel) or Transform Data (in Power BI). This opens the Power Query Editor.
- In the Power Query Editor, locate the Add Column tab in the ribbon at the top.
- Click Custom Column in the Add Column tab. A dialog box will appear.
- In the New column name field, type a clear name like
Today's DateorExtractDate. - In the Custom column formula field, type:
DateTime.Date(DateTime.LocalNow()). Do not include quotes or extra spaces. - Click OK. A new column will appear in your table with today’s date in YYYY-MM-DD format.
- Optionally, right-click the new column header and select Change Type > Date to confirm the data type.
- Click Close & Load (in Excel) or Close & Apply (in Power BI) to return to your worksheet or report.
- Verify the new column appears in your output with the correct date. Each time you refresh the query, this column will update automatically to today’s date.
Common Mistakes
- Typing
Today()— this function does not exist in Power Query M language. UseDateTime.LocalNow()instead. - Forgetting to use
DateTime.Date()aroundDateTime.LocalNow()— without it, you’ll get both date and time (e.g., 2024-06-15 14:30:22), which may clutter your output or cause formatting issues. - Using hardcoded dates like
"2024-06-15"— this defeats the purpose of automation and will require manual updates daily. - Adding the column before filtering or transforming data — if you add the date column too early, it may be removed unintentionally during later steps. Add it after your main transformations but before final loading.
- Accidentally changing the column’s data type to Text — if you do, the date will no longer update correctly on refresh. Always confirm the column type is Date.
Tips
- Use
DateTime.Date(DateTime.LocalNow())for local time zone accuracy. If your data is global and needs UTC, useDateTime.Date(DateTime.UtcNow()). - Combine today’s date with other columns using
Date.ToText(DateTime.Date(DateTime.LocalNow()), "MM/dd/yyyy")if you need a specific text format for display purposes. - For audit trails, consider adding a time column too:
DateTime.LocalNow()without theDate()wrapper will include hours and minutes. - Use the column to filter data dynamically — for example, only show records from today by applying a filter where
Today's Dateequals the value in your new column. - Test your query by changing your system date temporarily (in Windows Settings > Time & Language) to confirm the function updates correctly.
- Use descriptive names like
Report Run Dateinstead ofDate1to improve clarity for others reviewing your workbook.
Troubleshooting
- The column shows #ERROR — check your formula for typos. Ensure you typed
DateTime.Date(DateTime.LocalNow())exactly. Missing parentheses or capitalization errors cause this. - The date doesn’t update on refresh — verify you didn’t convert the column to Text. Right-click the column, choose Change Type, and select Date. Also confirm your query is set to refresh automatically under Data > Queries & Connections > Right-click query > Properties > Enable refresh.
- Power Query won’t open — ensure your data is formatted as a table (Ctrl+T in Excel). If using a range, highlight the data range first before clicking Get Data.
- Unexpected time zone — if your date appears one day off, your system time zone may be misconfigured. Check Windows Settings > Time & Language > Date & Time > Time zone. Power Query uses your system’s local time.
- Column disappears after refresh — this usually means your source data structure changed (e.g., columns renamed or removed). Re-run the query with the original source, then re-add the custom column.
- Getting "Expression.Error" — this is often due to a reference to a non-existent column. Double-check that your formula doesn’t accidentally reference a column name that was renamed or deleted.
Frequently Asked Questions
Can I use today’s date in a filter to show only today’s records?
Yes. After adding the today’s date column, click the filter arrow on your date column, select Date Filters > Equals, then choose theToday's Date column as the value. This dynamically filters to only show matching records.
Why does Power Query show the time when I only want the date?
BecauseDateTime.LocalNow() returns both date and time. Wrap it with DateTime.Date() to extract only the date portion. Without it, the time component remains visible.
Does this work with Excel Online or mobile Excel?
Yes, but only if you’re using the full Excel app on Windows or Mac. Excel Online and mobile apps do not support Power Query editing. You can view results, but you must edit the query on desktop.Can I add today’s date to multiple tables at once?
Yes. Repeat the custom column step in each query. Alternatively, create a separate query that returns just today’s date, then merge it into other queries using a join. This keeps the logic centralized.Will this work if my data source is a SharePoint list or SQL database?
Yes. Power Query’sDateTime.LocalNow() function runs on your local machine during query refresh, regardless of the source. The date is calculated locally and added to the result set.