Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
12 | |
8 | |
8 | |
7 |
User | Count |
---|---|
15 | |
13 | |
9 | |
7 | |
6 |