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.
Hi all,
I'm very new to Power BI, so I hope I don't upset anyone here.
I'm trying to understand how to add a dynamic query to get a file as data source.
Most of the file name is constant, but a new file with the current date is generated every day and I want to target that updated file as the data source. Kind of a regex, right?
I googled and find out it's possible to use DateTime.Date in the query as part of the File name.
That should fix my problem.
However, I don't understand the query I generated and I don't know in where should I modify/add this.
This is my current query:
let
Source = AzureStorage.Blobs("storageaccountname"),
backupreportsxlsx1 = Source{[Name="containername"]}[Data],
#"https://storageaccountname.blob.core.windows.net/containername/_filename-14-11-19.xlsx" = containername1{[#"Folder Path"="https://storageaccountname.blob.core.windows.net/containername/",Name="filename-14-11-19.xlsx"]}[Con...],
#"Imported Excel" = Excel.Workbook(#"https://storageaccountname.blob.core.windows.net/containername/filename-14-11-19.xlsx"),
file_Table = #"Imported Excel"{[Item="file",Kind="Table"]}[Data]
in
file_Table
Solved! Go to Solution.
Hi @Anonymous ,
We can try to use the following formula to meet your requirement, the filename will try to generate the name "filename-day-month-year.xlsx" of current day when refresh.
let
Source = AzureStorage.Blobs("storageaccountname"),
backupreportsxlsx1 = Source{[Name="containername"]}[Data],
filename = "filename-"
& Number.ToText(Date.Day(DateTime.LocalNow()))
& "-" & Number.ToText(Date.Month(DateTime.LocalNow()))
& "-" & Number.ToText(Date.Year(DateTime.LocalNow()))
& ".xlsx"
#"FileLocation" = containername1{[#"Folder Path"="https://storageaccountname.blob.core.windows.net/containername/",Name=filename}[Con...],
#"Imported Excel" = Excel.Workbook(#"FileLocation"),
file_Table = #"Imported Excel"{[Item="file",Kind="Table"]}[Data]
in
file_Table
Best regards,
Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
We can try to use the following formula to meet your requirement, the filename will try to generate the name "filename-day-month-year.xlsx" of current day when refresh.
let
Source = AzureStorage.Blobs("storageaccountname"),
backupreportsxlsx1 = Source{[Name="containername"]}[Data],
filename = "filename-"
& Number.ToText(Date.Day(DateTime.LocalNow()))
& "-" & Number.ToText(Date.Month(DateTime.LocalNow()))
& "-" & Number.ToText(Date.Year(DateTime.LocalNow()))
& ".xlsx"
#"FileLocation" = containername1{[#"Folder Path"="https://storageaccountname.blob.core.windows.net/containername/",Name=filename}[Con...],
#"Imported Excel" = Excel.Workbook(#"FileLocation"),
file_Table = #"Imported Excel"{[Item="file",Kind="Table"]}[Data]
in
file_Table
Best regards,
Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you for the help!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
100 | |
80 | |
64 | |
57 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |