The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello,
I am trying to create a custom column to convert a date to format "mmm-yy" using m code?
Solved! Go to Solution.
Hello @jcastr02
you can use Date.ToText(Date,"MMM-yy"). Here an example where I added a new column to make the transformation you need
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjDUAyIjA6VYHTjHEMwxsoBxYgE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}}, "de-DE"),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Date.ToText(_[Date], "MMM-yy"))
in
#"Added Custom"
Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Hello @jcastr02
you can use Date.ToText(Date,"MMM-yy"). Here an example where I added a new column to make the transformation you need
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjDUAyIjA6VYHTjHEMwxsoBxYgE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}}, "de-DE"),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Date.ToText(_[Date], "MMM-yy"))
in
#"Added Custom"
Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy