How to Dynamically change the Power Query Steps for the New File name

Hi There,
Can you please help me -
When I am adding new file , in power query the new name is not dynamically updating, when I went to advanced editor and change the file name from Jul- 2023 to Sep-2023 it worked perfectly. Even though power query was sorting and filter the latest file but the steps when the new file to be opened , it got stuck there.
There must be some way to dynamically change the latest file name so I do not need to manually change the name. I have attached the clip below.
Thanks in advance.

Answer:

Instead of filtering by name, you can filter the table by max date. Here’s a minimal example:

let
    Source = SharePoint.Files("https://company.sharepoint.com/sites/Site/", [ApiVersion = 15]),
    LastModified = List.Max(Source[Date modified]),
    ExcelSheet = Source{[#"Date modified"=LastModified]}[Content],
    ImportedExcel = Excel.Workbook(ExcelSheet)
in
    ImportedExcel

Thank you Alexis! I will apply accordingly! cheers