This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
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 column is in the dd/mm/yyyy format.
I need to change this so its in the yyyy-MM-dd format , but as a string.
I have added the following code
Solved! Go to Solution.
Try this: Table.TransformColumns(Navigation, {{"YYYY-MM-DD", each Date.ToText(_, "yyyy-MM-dd"), type text}}) and see if this solves your problem
Proud to be a Super User!
Yes it's possible. Please try this:
Table.TransformColumns(Navigation, {[#"Date"], each Date.ToText(_, "yyyy-MM-dd")})
Instead of "Table.AddColumn(Navigation, "Custom", each Date.ToText([#"Date"], "yyyy-MM-dd"))"
Proud to be a Super User!
Whilst visually, this looks correct, i just tried it and it gives me this error :
Expression.Error: There is an unknown identifier. Did you use the [field] shorthand for a _[field] outside of an 'each' expression?
I use tha name of my column Date where I want to transform.
Probably the error is on the [#"Date"]. Replace this column name for your column date name.
Proud to be a Super User!
I did that. My date column is called Y-M-D.
This is the code i am using
Try this: Table.TransformColumns(Navigation, {{"YYYY-MM-DD", each Date.ToText(_, "yyyy-MM-dd"), type text}}) and see if this solves your problem
Proud to be a Super User!
Thank you so much. That worked
Hi,
Try this code:
Date.ToText([Date], "yyyy-MM-dd")
Proud to be a Super User!
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
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 32 | |
| 26 | |
| 23 | |
| 20 | |
| 15 |
| User | Count |
|---|---|
| 64 | |
| 41 | |
| 28 | |
| 22 | |
| 22 |