March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe 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
Ok... so I'm trying to learn the basics of Power BI, and I have a few points that are just down right confusing...
This isn't specific to DateTime, but I'm using it as a sample function...
If I run this code:
#"Renamed Columns2" = Table.AddColumn(#"Renamed Columns1", "Executed", each DateTime.LocalNow()),
The system returns a "Function" hyperlink in the Executed column.
However, if I run this code:
#"Renamed Columns2" = Table.AddColumn(#"Renamed Columns1", "Executed", each DateTime.Date(DateTime.LocalNow())),
The system returns the current date.
Question: DateTime.LocalNow(), as I understand, returns the local date when executed as a date value. Why then do I have to use the additional DateTime.Date() to convert it from a "Function" hyperlink to the actual value.
Solved! Go to Solution.
Hi @Anonymous ,
I tried both scenarios in Power BI at my end.
Just wanted to check if you can paste screenshot of the FUNCTION message which you are getting while using DateTime.LocalNow() as I don't get any such message at my end?
If this helps and resolves the issue, appreciate a Kudos and mark it as a Solution! 🙂
Thanks,
Pragati
Hi @Anonymous ,
The DateTime.LocalNow() returns a datetime value set to the current date and time on the system.. See more:https://docs.microsoft.com/en-us/powerquery-m/datetime-localnow.
The DateTime.Date Convert DateTime format into Date format in Query Editor, see more: https://docs.microsoft.com/en-us/powerquery-m/datetime-date.
Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
I tried both scenarios in Power BI at my end.
Just wanted to check if you can paste screenshot of the FUNCTION message which you are getting while using DateTime.LocalNow() as I don't get any such message at my end?
If this helps and resolves the issue, appreciate a Kudos and mark it as a Solution! 🙂
Thanks,
Pragati
You were probably missing the " ( ) " at the end of the function.
If you call DateTime.LocalNow , the output is going to be Function
If you call DateTime.LocalNow(), the output is going to be the real current date, for example, 2024-08-05.
@Anonymous I don't know why you are getting function, DateTime.LocalNow() should return date/time (date with timestamp)
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@parry2k, thank you for the response. I should clarify I was doing this in Power Query / M, not DAX. I'll see if I can grab a screenshot for you today. Thank you for testing it out.
@Anonymous the sceenshot I shared is from power query not DAX.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
129 | |
90 | |
75 | |
58 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |