Forum Discussion

Norbertus123's avatar
Norbertus123
Frequent Visitor
2 years ago

dynamic sources relatative path

Hi,

I have a dataconnection to azuredevops with a OData.Feed Connector. With a function i get the needed information based on a WorktItemid 

But is a dynamic datasourse so this will not work in the PowerBI Services. I think i need to implemenate a RelativePath but how?

Can someone please help me with the next function

 

let
Source= (WorkItem as text) => let
  Source= OData.Feed("https://analytics.dev.azure.com/xxxx/xxx/_odata/v4.0-preview/WorkItems?$select=WorkItemId,WorkItemType,Title,State,StartDate&$filter=WorkItemId eq " & WorkItem , null, [Implementation="2.0"])
  in
  Source
in
Source

 

With kind regards Norbertus

 

 

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, Norbertus123 

    The Power BI service requires static data sources, and dynamic data sources can cause problems. However, you can use the and option in the function to construct dynamic URLs. You can try the following M query:

    let
    Source = (WorkItem as text) => let
        BaseURL = "https://analytics.dev.azure.com/xxxx/xxx/_odata/v4.0-preview/WorkItems",
        Options = [Implementation="2.0"],
        QueryOptions = [ 
            "$select" = "WorkItemId,WorkItemType,Title,State,StartDate",
            "$filter" = Text.Combine({"WorkItemId eq ", WorkItem})
        ],
        Source = OData.Feed(Web.Contents(BaseURL, [RelativePath = "", Query = QueryOptions]), null, Options)
    in
        Source
    in
    Source
    

     

    How to Get Your Question Answered Quickly

    Best Regards

    Yongkang Hua

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.