The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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