Forum Discussion
cristianml
4 years agoPost Prodigy
Transform Text to Month number query editor
Hi, I need to transform the Month name to month number, In same column or if not possible in aditional column. I tried the following custom column but doesn't work. Month Name Step: ...
- 4 years ago
Please try my sample in a new query and if that works then you can tweak to your needs in your query.
FYI, I change the column as "Month Name"
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8krMK00sqlSK1YlWcktNKoJzfBOLkjPALMeCoswcqBhEzqs0LxXKyIGIOJamlxaXgJnBqQUlqblJqUVgnn9yST6M7ZdfhpBA4bikJkM5sQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Month Name" = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Month Name", type text}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Month Number", each Date.Month(Date.FromText([Month Name], [Format="MMMM"])), Int64.Type) in #"Added Custom"
cristianml
4 years agoPost Prodigy
sevenhills
4 years agoSuper User
Please try my sample in a new query and if that works then you can tweak to your needs in your query.
FYI, I change the column as "Month Name"
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8krMK00sqlSK1YlWcktNKoJzfBOLkjPALMeCoswcqBhEzqs0LxXKyIGIOJamlxaXgJnBqQUlqblJqUVgnn9yST6M7ZdfhpBA4bikJkM5sQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Month Name" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Month Name", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Month Number", each Date.Month(Date.FromText([Month Name], [Format="MMMM"])), Int64.Type)
in
#"Added Custom"