Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have a column name called "Folder Path" which contains the following text:
\\test\testfolder\\test subfolder\DATA ABC Month-end Reports\2016 December\A
\\test\testfolder\\test subfolder\DATA ABC Month-end Reports\2016 March\A
\\test\testfolder\\test subfolder\DATA ABC Month-end Reports\2013 May\B
\\test\testfolder\\test subfolder\DATA ABC Month-end Reports\2023 August\C
Is there a way I can extract the year and month (highlighted in red) from each line into a new column so I can format them into a date format?
Solved! Go to Solution.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WigGCktTiEgiZlp+TkloEE1MoLk2Cibg4hjgqODo5K/jm55Vk6KbmpSgEpRbkF5UUx8QYGRiaKbikJqfmJoGUOirF6lDRYN/EouQMKptqDDS1MibGiYpmGhkrOJaml4KMcVaKjQUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Folder Path" = _t]),
#"Added Custom" = Table.AddColumn(Source, "Date", each Date.From(Text.Split([Folder Path],"\"){7} & " 1"),type date)
in
#"Added Custom"
How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done". Once you examined the code, replace the Source step with your own source.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WigGCktTiEgiZlp+TkloEE1MoLk2Cibg4hjgqODo5K/jm55Vk6KbmpSgEpRbkF5UUx8QYGRiaKbikJqfmJoGUOirF6lDRYN/EouQMKptqDDS1MibGiYpmGhkrOJaml4KMcVaKjQUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Folder Path" = _t]),
#"Added Custom" = Table.AddColumn(Source, "Date", each Date.From(Text.Split([Folder Path],"\"){7} & " 1"),type date)
in
#"Added Custom"
How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done". Once you examined the code, replace the Source step with your own source.