Showing results for 
Search instead for 
Did you mean: 
Resident Rockstar
Resident Rockstar

Dynamically Set Data Source Links

The situation I have is that one department creates spreadsheets ~1x per month and puts them in a shared folder. Then the next year starts a new folder. I have a report that wants to use the most recent file from each year as data.  After manually updating the power query each month for a while, I decided that was too much effort, and have been trying to streamline the process.


So I changed to loading in a new excel sheet as the table 'SpreadsheetLinks', with the following format:

Report YearHyperlink{Dec2021Data}.xlsx{MostRecent2022Data}.xlsx


Which allows my power query to use this as a data source for each of my data tables, changing the year to match the data table:


Source = Excel.Workbook( Web.Contents( SpreadsheetLinks[Hyperlink]{ List.PositionOf(SpreadsheetLinks[Report Year], 2022, 0)}), null, true)


My original plan was to point the users to this new sheet, and let the other department update the link when the file is ready, and it would get caught in the next refresh. This works great when running in desktop and publishing. The issue is that I can no longer refresh the dataset in the PBI service, and get this error: This dataset includes a dynamic data source. Since dynamic data sources aren't refreshed in the Power BI service, this dataset won't be refreshed. 


I understand that this has to do with security concerns, and MS trying to avoid various problems that could arise from wantonly opening untested files.  I found solutions like this one using parameters that seem more suited to paginated API data, but I'm unsure how to use it to apply dynamic URL values stored in a separate file. 


At the end of the day, as long as I have an easy method to change the dataset's URL each month (preferably one that doesn't require me to open PBI Desktop and re-upload!) I'll be happy.

Super User
Super User

@Cmcmahan maybe the easier would be, after you list all the files, first add a step to sort by report date (z to a), in the next step, keep the first row, so you will be left with the most recent file, and then just expand it, no more, parameters etc will be required.


Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Did I answer your question? Mark my post as a solution.

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources


2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

Thank you 2022 Review

2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture.