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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
negbc
Frequent Visitor

Setting Up Dynamic Source File Name

I'm looking to create a source file path to which the file name can change dynamically by date. I will have a daily extract to a folder, with the same naming convention "Name.YYMMDD" with that date being the extract date. In power query I want to connect, for example, to the file the is -7 days from today, or -14 days from today. Is there a way to format the file path so it changes everyday when the report freshes to file name that has the date corresponding to the date -7 days from the current day?

2 REPLIES 2
dufoq3
Super User
Super User

Hi @negbc,

 

dufoq3_0-1715015658627.png

= "Name." & Date.ToText(Date.AddDays(Date.From(DateTime.FixedLocalNow()), -7), [Format="yyyyMMdd"])

Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

negbc
Frequent Visitor

Would this replace the entire source code? or would I still need some of the elements that as shown below and replace the file path with the code you provided?

 

negbc_0-1715171924527.png

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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