Forum Discussion
Issue with adding datetime.localnow() column in dataflow gen2
- 1 year ago
Hello yangty ,
Thank you for your response. As this issue appears to be a potential bug, I suggest raising a Microsoft Fabric support ticket for further investigation.
To submit a support ticket for Fabric and Power BI, please follow the steps outlined in this guide:
How to create a Fabric and Power BI Support ticket - Power BI | Microsoft Learn
If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
Hi yangty ,
Thanks for contacting the Microsoft Fabric Community. We were able to reproduce your issue. The error occurs because Power Query treats DateTime.LocalNow() differently in the editor versus when refreshing the Dataflow.
Add the ETL_upload_datetime Column:
- In the Power Query Editor, create a new column using the following formula.
Formula: DateTime.LocalNow()
2. This will add the current timestamp as a DateTime value.
However, if this doesn’t work as expected after refreshing, try changing the formula to.
Formula: DateTime.From(DateTime.LocalNow())
Both formulas should work. Could you please try these and let us know if you need any further assistance? We are ready to help.
If my response solved your query, please mark it as the Accepted solution to help others find it easily.
And if my answer was helpful, I'd really appreciate a 'Kudo'.
Thank you for your response, the first formula was the one I used before and didn't work, I tried the second mehtod, but still get the same error message. Is it possible that I'm trying to load the data to a datawarehouse table, in the DW table I used datetime data type.