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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Learning PowerBI: Why do functions return "function" in a table, instead of actual "value"?

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.

 

 

1 ACCEPTED SOLUTION
Pragati11
Super User
Super User

Hi @Anonymous ,

 

I tried both scenarios in Power BI at my end.

  1. Created a custome column "test" using DateTime.LocalNow(). This gave me the current value in date-time format.dt1.png
  2. Created a custom column "test1" usingDateTime.Date(DateTime.LocalNow()). This gave me the current value indate format.
  3. dt2.png

         

 

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

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

View solution in original post

5 REPLIES 5
v-xicai
Community Support
Community Support

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.

Pragati11
Super User
Super User

Hi @Anonymous ,

 

I tried both scenarios in Power BI at my end.

  1. Created a custome column "test" using DateTime.LocalNow(). This gave me the current value in date-time format.dt1.png
  2. Created a custom column "test1" usingDateTime.Date(DateTime.LocalNow()). This gave me the current value indate format.
  3. dt2.png

         

 

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

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

parry2k
Super User
Super User

@Anonymous I don't know why you are getting function, DateTime.LocalNow() should return date/time (date with timestamp)

 

image.png

 

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.

Anonymous
Not applicable

@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.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.