Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
How do i change the YYYY-MM-DD format shown in the picture to match the YYYYMM format also shown in the picture?
Thanks
Solved! Go to Solution.
You can transform the column twice to get your result. The first to replace the "-" with "" and the second to extract the first 6 characters.
Here's an example. To see how it works, just create a blank query, open the Advanced Editor and replace the text there with the M code below.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtI1MNQ1MjJQitWB8A2MlGJjAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
#"Replaced Value" = Table.ReplaceValue(#"Changed Type","-","",Replacer.ReplaceText,{"Column1"}),
#"Extracted First Characters" = Table.TransformColumns(#"Replaced Value", {{"Column1", each Text.Start(_, 6), type text}})
in
#"Extracted First Characters"
Pat
You can transform the column twice to get your result. The first to replace the "-" with "" and the second to extract the first 6 characters.
Here's an example. To see how it works, just create a blank query, open the Advanced Editor and replace the text there with the M code below.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtI1MNQ1MjJQitWB8A2MlGJjAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
#"Replaced Value" = Table.ReplaceValue(#"Changed Type","-","",Replacer.ReplaceText,{"Column1"}),
#"Extracted First Characters" = Table.TransformColumns(#"Replaced Value", {{"Column1", each Text.Start(_, 6), type text}})
in
#"Extracted First Characters"
Pat
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 9 | |
| 8 | |
| 7 | |
| 6 |