Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Issues with dynamic token: dynamic data sources aren't refreshed in the Power BI service, this datas

Hi all,

I trying to fetch data via API which needed dynamic token; I am successful in retriving data in Power BI desktop but when I publish the same on Power BI Service I am getting an error (when refresh) as below,
This dataset includes a dynamic data source. Since dynamic data sources aren't refreshed in the Power BI service, this dataset won't be refreshed. Learn more: https://aka.ms/dynamic-data-sources.

Here is what I had tried to get Token:
// I created parameters (URL, grant_type...) & using them here ,
---------------------------------------------------------------

= () =>
let
url = URL,  
body = [
grant_type = grant_type,
client_id = client_id,
client_secret = client_secret,
username = username,
password = password
],

nice = Json.Document(Web.Contents(url,
[
Headers = [#"Content-Type" = "application/x-www-form-urlencoded"],
Content = Text.ToBinary(Uri.BuildQueryString(body))
]
)
),
niceToken = nice[access_token]
in
niceToken
---------------------------------------------------------------

Above code is successfully returning the token when I invoke it. now I am trying to use this dynamic token into the main call,
---------------------------------------------------------------
let
Source = Json.Document(Web.Contents(DataURL,
[
Headers=[Authorization="Bearer " & Token()]
]))
in
Source
---------------------------------------------------------------
Which is returning data to me in Power BI Desktop but same not working in Service; what could be the potential issue?

Appreciate your help.


  • Anonymous's avatar
    Anonymous
    3 years ago

    I got the solution from Curbals youtube video.

    all dynamic parts must be added as query then it will work.
    Json.Document(Web.Contents(DataURL,
    [
    RelativePath = "performance?",
    Query = [
    startDate=sDt,
    endDate=eDt
    ],
    Headers=[Authorization="Bearer " & Token()]
    ]))

4 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks amitchandak ,
      If you look at the code I shared; I have already implemented the solution mentioned in the blog. I even getting the data but its not working in PBI Service due to dynamic parameter (dates).

      Appreciate if you can help on that.

      • Anonymous's avatar
        Anonymous
        Not applicable

        I got the solution from Curbals youtube video.

        all dynamic parts must be added as query then it will work.
        Json.Document(Web.Contents(DataURL,
        [
        RelativePath = "performance?",
        Query = [
        startDate=sDt,
        endDate=eDt
        ],
        Headers=[Authorization="Bearer " & Token()]
        ]))