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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Power query logic to pick the current year folder

Hi Power BI aficionados

 

So we have a bunch of Power BI reports whose sources are yearly folders maintained on our corporate network. At the end every year, we need to repoint the folder to the present year in order for the report to render current year information. For example,  I've had to manually change the source folder from 2019 to 2020 once we transitioned into 2020. Is there a way we can automate this? In other words, is it possible via power query for the source to automatically point to the current year folder without me having to do the manual step? Let me know if you'd like more details. Thanks in advance for your help.

 

SourceFolder.JPG

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Anonymous ,

 

This can be achieve by the use of parameters check the video below with a full explanation, you don't need to create an excel spreadsheet with the path information but you can use an alternate version by doing the following code in the source:

 

"C:\folder\folder" & Parameter_Name & "\Folder\Folder\"

 

 

 

 

Then you just need to choose the parameter to adjust your PBIX file.

 

 

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

3 REPLIES 3
MFelix
Super User
Super User

Hi @Anonymous ,

 

This can be achieve by the use of parameters check the video below with a full explanation, you don't need to create an excel spreadsheet with the path information but you can use an alternate version by doing the following code in the source:

 

"C:\folder\folder" & Parameter_Name & "\Folder\Folder\"

 

 

 

 

Then you just need to choose the parameter to adjust your PBIX file.

 

 

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



PaulDBrown
Community Champion
Community Champion

It sounds like a task which Power Automate/ Flow is capable of doing with some tweaks. (Not that I a know much about Power Automate/Flow)




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






kentyler
Solution Sage
Solution Sage

You can't do this directly....:) but here is a link to a RADCAD post that gives step by step instructions for doing it in M in the query editor.

https://radacad.com/fetch-files-andor-folders-with-filtering-and-masking-power-query

 

I'm a personal Power Bi Trainer I learn something every time I answer a question

The Golden Rules for Power BI

  1. Use a Calendar table. A custom Date tables is preferable to using the automatic date/time handling capabilities of Power BI. https://www.youtube.com/watch?v=FxiAYGbCfAQ
  2. Build your data model as a Star Schema. Creating a star schema in Power BI is the best practice to improve performance and more importantly, to ensure accurate results! https://www.youtube.com/watch?v=1Kilya6aUQw
  3. Use a small set up sample data when developing. When building your measures and calculated columns always use a small amount of sample data so that it will be easier to confirm that you are getting the right numbers.
  4. Store all your intermediate calculations in VARs when you’re writing measures. You can return these intermediate VARs instead of your final result  to check on your steps along the way.




Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors