Forum Discussion

IXH's avatar
IXH
Regular Visitor
4 years ago

Power BI Odata.feed parameters

I’m trying to make my Odata extracts into Power BI more efficient by filtering the data at the time of the extraction.

 

Currently in PowerBI Desktop I have the following which works.

let

    Source = OData.Feed("http://localhost:5560/api/OData?$path=", null, [Implementation="2.0"]),

    TEST_table = Source{[Name="TEST",Signature="table"]}[Data]

in

    TEST_table

 

 

I’m  trying to understand how to include the source table in the OData.Feed Url and then also add filters.

 

The following URLs work in my brower.

http://localhost:5560/api/OData/Data.TEST

and also

http://localhost:5560/api/OData/Data.TEST?$filter=FiscalYear eq 2020

 

I’ve looked at many posts and tried various option and received many different error messages.

Any help would be appreciated.

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi IXH ,

     

    As the official document said, Before you use the query in Power BI, you must convert the multiline OData query into a single-line query. The simplest way to do so is to use Visual Studio Code with the OData extension and use the OData: Combine command.

     

    1.In Visual Studio Code, place your query anywhere in the query text, and then select View > Command Palette. In the search box, type odata and then, in the results list, select OData: Combine.

    The multiline query is converted into a single-line query.

     

    2.In Power BI , get data from ODATA Feed--> in the URL box, paste the OData query that you copied in the preceding section, and then select OK.

     

    Here is a similar thread in which some explanations are mentioned on this issue. You may check if it helps in your scenario.

     

     

     

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

    • IXH's avatar
      IXH
      Regular Visitor

      Thanyou. I've Visual Studio and had a with the OData.Combine and Odata.Open.

       

      I beliver the correct URL is  http://localhost:5550/api/OData/Data.TEST 

      but I receive the following messages.

      The feed's metadata document appears to be invalid. Error: A supported MIME type could not be found that matches the content type of the response. None of the supported type(s) 'application/xml' matches the content type 'application/json; odata.metadata=minimal; odata.streaming=true; IEEE754Compatible=false; charset=utf-8'

       

       

      It brings back data the browers. The $metadata is 

            "name": "TEST",

            "kind": "EntitySet",

            "url": "Data.TEST"

       

      thanks

      Ingrid

       

        ]

      }