I recently blogged about how Power BI has a bug which ignores the select statements when querying an OData v4 endpoint. Even though the columns would include any data, it still bugged me so much that I wanted to find a way around it.
Turns out that’s much easier than you would expect.
I recently explored some of the different data loading capabilities in PBI, and it turns out that there’s a Json.Document function which allows you to handle OData at an even lower level.
So what I did was take my original uri and query string: https://<org>.api.crm4.dynamics.com/api/data/v8.2/opportunities?$select=name
Then I put it into a Json.Document(Web.Contents())
And voila, this is the result
Navigating into that list, you can then right click the column and select “To Table”. This will present you with a table of records ready to be exploded:
So, time to do a little speed testing
Unfortunately max 5000 records only
ReplyDeleteHow did you put it into the JSON.Document...what were your steps for a newbie?
ReplyDeleteFirst you have to generate an OData query. If you haven't spent extensive time building queries before I recommend looking into the OData query builder created by Jason Latimer https://github.com/jlattimer/CRMRESTBuilder
DeleteAfter you have a valid OData url then you can create a new blank query in Power BI. Then, click on the advanced editor, and add the following:
let
Source = Json.Document(Web.Contents("your-url-inside-here-do-not-remove-quotation-marks")
in
Source
Finally, drill into the list and expand the way you want to use the data. See my other blog post for how to expand Dynamics data from a Json.Document here: http://www.crmviking.com/2018/01/dynamic-option-sets-in-powerbi.html
Tried this out and seems to be quick, but does not seem to work for lookup fields. Lookups error out and you cannot access even the associated guid...or maybe I'm doing it wrong...
ReplyDeleteNot sure what you're doing, but I do get lookup ids when I use this. Joins and expands needs to be done manually since Web.Contents doesn't utilize the ODatav4 capabilities.
Delete