Forum Discussion

ppodgorski's avatar
ppodgorski
Frequent Visitor
6 years ago

Invoked Custom Function references other queries or steps, so it may not directly access a data sour

Any assistance would be greatly appreciated.

 

My report refreshes fine and quick on Desktop but fails on Service with error: 

 

"Section1/TasksList2/Invoked Custom Function references other queries or steps, so it may not directly access a data source. Please rebuild this data combination"

 

The custom function I'm using calls an API that requires a "TASK ID" to be passed. Power BI executes this call for each row in the table.

 

The query TasksList2 is:

 

let
    Source = TasksList,
    #"Invoked Custom Function" = Table.AddColumn(Source, "Organisation", each #"Task Links"([TASK_ID_TEXT]))
in
    #"Invoked Custom Function"

The function "Task Links" is:

let
    Source = (TaskID as text) => let
        Source = Json.Document(Web.Contents(
            "https://api.insightly.com/v3.1/Tasks/",
            [
                RelativePath= TaskID & "/Links"
            ])),
        Custom1 = Table.FromRecords(Source),
        #"Filtered Rows1" = Table.SelectRows(Custom1, each [LINK_OBJECT_NAME] = "Organization")
    in
        #"Filtered Rows1"
in
    Source

 

I've already followed other advise on this forum to isolate the query "Tasks" into it's own query "TasksList2", and use the "RelativePath" parameter in the Web.Contents function instead of directly passing the TASKID parameter.