Query references other queries or steps, so it may not directly access a data source
Hi,
Newbie here. I'm trying to calculate a delta between two dates in my query (RequestedCompletionDate and ActualCompletionDate). I found ImkeF's Networkdays function and was able to use it initally, but now it gives me an error:
"Formula.Firewall: Query 'ProjectTiming' (step 'Added Custom1') references other queries or steps, so it may not directly access a data source. Please rebuild this data combination."
I've read a couple of other posts on this topic, and a common proposed solution is to integrate the custom function within your query. I can't seem to get the syntax correct. Here's my query (note: GetDataProjectTiming is a custom function that contains the particulars of the API call to our work system--my query paginates the data from this function; this works fine--it's integrating the Networkdays function that's throwing the error):
let
Source = List.Generate(
()=> [Result = try GetDataProjectTiming(0) otherwise null, Offset = 0],
each List.IsEmpty([Result][data]) <> true,
each [Result = try GetDataProjectTiming([Offset]+2000) otherwise null, Offset = [Offset]+2000],
each [Result]),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"data"}, {"data"}),
#"Expanded data" = Table.ExpandListColumn(#"Expanded Column1", "data"),
#"Expanded data1" = Table.ExpandRecordColumn(#"Expanded data", "data", {"ID", "name", "owner", "referenceNumber", "actualCompletionDate", "DE:Requested completion date", "DE:Project Timing", "DE:Proposition this request falls under."}, {"ID", "name", "owner", "referenceNumber", "actualCompletionDate", "DE:Requested completion date", "DE:Project Timing", "DE:Proposition this request falls under."}),
#"Expanded owner" = Table.ExpandRecordColumn(#"Expanded data1", "owner", {"name"}, {"name.1"}),
#"Renamed Columns" = Table.RenameColumns(#"Expanded owner",{{"ID", "ProjectID"}, {"name", "ProjectName"}, {"name.1", "OwnerName"}, {"referenceNumber", "ReferenceNumber"}, {"actualCompletionDate", "actualCompletionDateOLD"}, {"DE:Requested completion date", "RequestedCompletionDate"}, {"DE:Project Timing", "ProjectTiming"}, {"DE:Proposition this request falls under.", "Proposition"}}),
#"Added Custom" = Table.AddColumn(#"Renamed Columns", "ActualCompletionDate", each Text.RemoveRange([actualCompletionDateOLD], 19, 4)),
#"Changed Type" = Table.TransformColumnTypes(#"Added Custom",{{"ActualCompletionDate", type datetimezone}}),
#"Changed Type1" = Table.TransformColumnTypes(#"Changed Type",{{"ActualCompletionDate", type date}, {"ProjectID", type text}, {"ProjectName", type text}, {"OwnerName", type text}, {"ReferenceNumber", Int64.Type}, {"RequestedCompletionDate", type date}, {"ProjectTiming", type text}, {"Proposition", type text}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"actualCompletionDateOLD"}),
#"Added Custom1" = Table.AddColumn(#"Removed Columns", "Delta", each NetworkDays([ActualCompletionDate], [RequestedCompletionDate], Holidays[HolidayDate]))
in
#"Added Custom1"Any help would be greatly appreciated. Thanks!
I tried removing the holiday component as a parameter in the function and hard-coding a reference to the list object:
I tested it, and the function itself works--I was able to get the correct values by inputting test start and end dates. However, when I use the function in my main query (again, passing only the start and end dates), I still get the "references other queries" error.
I may have to just stick with the combo method (calling the SharePoint list of holidays directly in my main query) or try calculating the delta in a DAX measure.