Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
chrisread9907
Frequent Visitor

Today Function in Column

Hi,

 

I have this custom column:

 

= Table.AddColumn(#"Changed Type1", "Is Today", each if [datStart.1] = #date(2016, 11, 3) then "1" else "0" )

 

The result is a 0 or 1 dependandt on if the date is 03/11/16. 

 

How can i make it so that the date is always today like in excel TODAY() ?

1 ACCEPTED SOLUTION
BhaveshPatel
Community Champion
Community Champion

You should use calculated column in Data view.

 

DAX has the same syntex as Excel for creating today's date.

 

=TODAY()

 

for the Query Editor, Create a new column ans use the below syntax

 

DateTime.LocalNow()

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

View solution in original post

2 REPLIES 2
BhaveshPatel
Community Champion
Community Champion

You should use calculated column in Data view.

 

DAX has the same syntex as Excel for creating today's date.

 

=TODAY()

 

for the Query Editor, Create a new column ans use the below syntax

 

DateTime.LocalNow()

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.
KHorseman
Community Champion
Community Champion

The M query language equivalent is DateTime.LocalNow(). Technically that returns date/time; if you need strictly date-only you have to wrap that in Date.From(). So Date.From(DateTime.LocalNow()).

 

Alternatively you could load the query and add the column in the table editor. That way you can use DAX instead of M, so you can still use TODAY() just like in Excel.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.