Forum Discussion
PPStar
2 years agoHelper V
Format Date Column
Hello. I have a dataflow in the power BI Service. There is a date column (Date) which needs to be as a text data type (dont ask why) and needs to be in a specific format. Currently the date colum...
- 2 years ago
Try this: Table.TransformColumns(Navigation, {{"YYYY-MM-DD", each Date.ToText(_, "yyyy-MM-dd"), type text}}) and see if this solves your problem
_AAndrade
2 years agoResident Rockstar
Hi,
Try this code:
Date.ToText([Date], "yyyy-MM-dd")
- PPStar2 years agoHelper V
Thanks. That worked.
Do you know how i can alter the existing M code - so we dont create a new column
At the moment i have this M code
#"Added custom" = Table.AddColumn(Navigation, "Custom", each Date.ToText([#"Date"], "yyyy-MM-dd")),#"Transform columns" = Table.TransformColumnTypes(#"Added custom", {{"Custom", type text}})This create a new column called Custom. Whilst this works. I want to acheive the same without creating a new columnCan we just modify the existing column to ensure its in yyyy-MM-dd format and as text?