Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Cmcmahan
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
2021fileshare.website/{Dec2021Data}.xlsx
2022fileshare.website/{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.

1 REPLY 1
parry2k
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!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


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

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.