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

Having a dynamic source path (folder and files)

Hi,

 

I have a PBI report which shows a monthly project details based on the excel files that the team uses on a monthly basis. The data source has:

- Monthly folder (Example, "12- December", "11 November", etc) 

 -Under each monthly folder there are monthly files ("12- Project list data.xlsx", "11- Project list data.xlsx", etc.)

 

I want to automate the data source path so that it takes the data from the current month folder and file. So for December, the source path should be "c\.....12-December\12- Project list data.xlsx". 
Is it possible to have a dynamic path so that I do not need to change the source path every month?

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

Do you have multiple years of monthly folders in the root folder? I see you only have Month number and name in the folder name without year, so I'd like to know whether "1-January" folder only includes the file for the current 2023 January? If so, you can try

= Excel.Workbook(File.Contents("C:\........root folder\" & Text.From(Date.Month(DateTime.LocalNow())) & "-" & Date.MonthName(DateTime.LocalNow()) & "\" & Text.From(Date.Month(DateTime.LocalNow())) & "-Project list data.xlsx"), null, true)

vjingzhang_0-1673592392062.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

1 REPLY 1
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

Do you have multiple years of monthly folders in the root folder? I see you only have Month number and name in the folder name without year, so I'd like to know whether "1-January" folder only includes the file for the current 2023 January? If so, you can try

= Excel.Workbook(File.Contents("C:\........root folder\" & Text.From(Date.Month(DateTime.LocalNow())) & "-" & Date.MonthName(DateTime.LocalNow()) & "\" & Text.From(Date.Month(DateTime.LocalNow())) & "-Project list data.xlsx"), null, true)

vjingzhang_0-1673592392062.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

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
Top Kudoed Authors