Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi good day, can anyone help me on my PQ, the name of my data source change every week.. WK12..WK13 and so on. I want it to be dynamic.Can anyone help me to edit my PQ.
let
Source = Excel.Workbook(Web.Contents("https://company.sharepoint.com/sites/EASTWEST/Shared%20Documents/General/East%20West%20Current%20Act...WK12.xlsx"), null, true),
Thank you
Solved! Go to Solution.
Hi @AllanBerces Have you used the code that provided ? Maybe you have used but i couldnt see any ways could you try this please
let
// Get the current week number (WK12, WK13, etc.)
CurrentWeek = "WK" & Text.PadStart(Text.From(Date.WeekOfYear(DateTime.LocalNow(), Date.FirstDayOfWeek.Monday)), 2, "0"),
// Construct the full file path dynamically
FilePath = "https://company.sharepoint.com/sites/EASTWEST/Shared%20Documents/General/East%20West%20Current%20Act..." & CurrentWeek & ".xlsx",
// Load the file from SharePoint
Source = try Excel.Workbook(Web.Contents(FilePath), null, true) otherwise
error "File for " & CurrentWeek & " not found. Please check the file path or week logic.",
// Access the 'Asset' sheet
#"Asset_Sheet" = Source{[Item="Asset",Kind="Sheet"]}[Data],
// Promote headers
#"Promoted Headers" = Table.PromoteHeaders(#"Asset_Sheet", [PromoteAllScalars=true]),
// Change column types
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers", {
{"WON", Int64.Type},
{"Location", type text},
{"Complex/#(lf)Outstation", type text},
{"Order Type", type text},
{"Discpline", type text},
{"Description", type text},
{"Asset Cat. Tool (ACT)", type text},
{"BSP Turnaround", type text},
{"Execution Window", type any},
{"BSP Estimate", Int64.Type},
{"Est. hrs", type number},
{"Active/#(lf)Inactive", type text},
{"FWL", type text},
{"INJECTED", type any},
{"PENDING #(lf)CI", type text},
{"DEFERRED/#(lf)CANCELLED", type text}
})
in
#"Changed Type"
Hi @AllanBerces
I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.
Hi @AllanBerces
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.
Hi @AllanBerces
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
Hi @AllanBerces Please try this
let
CurrentWeek = "WK" & Text.PadStart(Text.From(Date.WeekOfYear(DateTime.LocalNow())), 2, "0"),
FilePath = "https://company.sharepoint.com/sites/EASTWEST/Shared%20Documents/General/East%20West%20Current%20Act..." & CurrentWeek & ".xlsx",
Source = Excel.Workbook(Web.Contents(FilePath), null, true)
in
Source
Hi @Akash_Varuna thank you for the reply, but when I try i m getting some error. below my complete editor
let
Source = Excel.Workbook(Web.Contents("https://Company.sharepoint.com/sites/EASTWEST/Shared%20Documents/General/East%20West%20Current%20Act..."), null, true),
#"Asset_Sheet" = Source{[Item="Asset",Kind="Sheet"]}[Data],
#"Promoted Headers" = Table.PromoteHeaders(#"Asset_Sheet", [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"WON", Int64.Type}, {"Location", type text}, {"Complex/#(lf)Outstation", type text}, {"Order Type", type text}, {"Discpline", type text}, {"Description", type text}, {"Asset Cat. Tool (ACT)", type text}, {"BSP Turnaround", type text}, {"Execution Window", type any}, {"BSP Estimate", Int64.Type}, {"Est. hrs", type number}, {"Active/#(lf)Inactive", type text}, {"FWL", type text}, {"INJECTED", type any}, {"PENDING #(lf)CI", type text}, {"DEFERRED/#(lf)CANCELLED", type text}})
in
#"Changed Type"
Thank you
Hi @AllanBerces Have you used the code that provided ? Maybe you have used but i couldnt see any ways could you try this please
let
// Get the current week number (WK12, WK13, etc.)
CurrentWeek = "WK" & Text.PadStart(Text.From(Date.WeekOfYear(DateTime.LocalNow(), Date.FirstDayOfWeek.Monday)), 2, "0"),
// Construct the full file path dynamically
FilePath = "https://company.sharepoint.com/sites/EASTWEST/Shared%20Documents/General/East%20West%20Current%20Act..." & CurrentWeek & ".xlsx",
// Load the file from SharePoint
Source = try Excel.Workbook(Web.Contents(FilePath), null, true) otherwise
error "File for " & CurrentWeek & " not found. Please check the file path or week logic.",
// Access the 'Asset' sheet
#"Asset_Sheet" = Source{[Item="Asset",Kind="Sheet"]}[Data],
// Promote headers
#"Promoted Headers" = Table.PromoteHeaders(#"Asset_Sheet", [PromoteAllScalars=true]),
// Change column types
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers", {
{"WON", Int64.Type},
{"Location", type text},
{"Complex/#(lf)Outstation", type text},
{"Order Type", type text},
{"Discpline", type text},
{"Description", type text},
{"Asset Cat. Tool (ACT)", type text},
{"BSP Turnaround", type text},
{"Execution Window", type any},
{"BSP Estimate", Int64.Type},
{"Est. hrs", type number},
{"Active/#(lf)Inactive", type text},
{"FWL", type text},
{"INJECTED", type any},
{"PENDING #(lf)CI", type text},
{"DEFERRED/#(lf)CANCELLED", type text}
})
in
#"Changed Type"
Hi @Akash_Varuna @v-priyankata Thank you very much for the reply. all good working as i need.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
13 | |
12 | |
9 | |
8 |
User | Count |
---|---|
17 | |
9 | |
8 | |
7 | |
7 |