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.
Hello,
I need to work with the latest file in a Sharepoint document folder.
The name of the Sharepoint site is let's say "https://myCompanySPurl/sites/SPSite" and the folder where my files are stored is let's say "myFolder".
The files stored in this folder follow this rule : myFile_YYYYMMDDHHMM.xls
So when I mean that I must read the latest file, it must be based on the information within the filename and not the modified or creation date of the file itself or the date where it has been stored in the Sharepoint folder.
I also need to retrieve the date entered within the file name in order to display it in a card visual and provide information about the date to which the file's data corresponds.
Do you have any idea how to do that please ?
Regards,
Julien
Solved! Go to Solution.
Add a new column with this formula:
let varName = Text.BetweenDelimiters([File Name], "_", ".") in
#datetime(Number.From(Text.Start(varName, 4)), Number.From(Text.Middle(varName,5,1)), Number.From(Text.Middle(varName, 6, 2)), Number.From(Text.Middle(varName,8,2)), Number.From(Text.End(varName,2)),0)
It will give you this, and you can filter using the filters for Is Latest.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingYou could just split off the "myFile_, then change to number. Then you can just sort it descending and choose first row--seems like you can already just sort ascending--isn't that why you named the files in that format?
--Nate
Add a new column with this formula:
let varName = Text.BetweenDelimiters([File Name], "_", ".") in
#datetime(Number.From(Text.Start(varName, 4)), Number.From(Text.Middle(varName,5,1)), Number.From(Text.Middle(varName, 6, 2)), Number.From(Text.Middle(varName,8,2)), Number.From(Text.End(varName,2)),0)
It will give you this, and you can filter using the filters for Is Latest.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingThis 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 | |
7 | |
6 | |
5 |