Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

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.


1 ACCEPTED SOLUTION
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()]
]))

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous , refer if this can help

https://www.advaiya.com/generate-dynamic-token-and-get-data-from-custom-api-in-power-bi/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
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
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()]
]))

Hello, I have a very similar problem when putting a dynamic hour directly in my query, could you tell me what is the link of the curbals video you are talking about?

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors