Forum Discussion
You can't schedule refresh for this semantic model
Hi,
I'm new in Power BI and I currently facing an issue about this particular semantic model. In settings, it is saying "You can't schedule refresh for this semantic model because the following data sources currently don't support refresh:
- Data source for Query1"
Below is the code in advance editor of a particular query:
Hi bebeben10,
I think the issue is with how you're using Web.Contents() with dynamic parameters. Power BI Service can't refresh queries that use Web.Contents() with dynamically constructed URLs unless you follow specific patterns for query folding.
Possible Solution - Use static base URL with dynamic parameters:
Replace your GetJson function with this:
GetJson = (RelativePath as text, QueryParameters as record) => let // Build query string manually QueryString = Uri.BuildQueryString(QueryParameters), FullUrl = BaseUrl & RelativePath & (if QueryString = "" then "" else "?" & QueryString), Options = [ Headers = [ Authorization = "Bearer " & Token, #"Harvest-Account-ID" = AccountID, #"User-Agent" = "PowerBI" ] ], RawData = Web.Contents(FullUrl, Options), Json = Json.Document(RawData) in Json,Better solution - Make credentials recognizable:
Power BI needs to recognize the data source. Try this approach:
GetJson = (RelativePath as text, PageNum as number) => let Options = [ Headers = [ Authorization = "Bearer " & Token, #"Harvest-Account-ID" = AccountID, #"User-Agent" = "PowerBI" ] ], FullUrl = "https://api.harvestapp.com" & RelativePath & "?page=" & Number.ToText(PageNum), RawData = Web.Contents(FullUrl, Options), Json = Json.Document(RawData) in Json,Also check: In Power BI Service, go to Settings → Data source credentials and ensure your API token parameter is configured as a dataset parameter with proper credentials set.
Best regards!
PS: If you find this post helpful consider leaving kudos or mark it as solution
4 Replies
- Mauro89
Super User
Hi bebeben10,
I think the issue is with how you're using Web.Contents() with dynamic parameters. Power BI Service can't refresh queries that use Web.Contents() with dynamically constructed URLs unless you follow specific patterns for query folding.
Possible Solution - Use static base URL with dynamic parameters:
Replace your GetJson function with this:
GetJson = (RelativePath as text, QueryParameters as record) => let // Build query string manually QueryString = Uri.BuildQueryString(QueryParameters), FullUrl = BaseUrl & RelativePath & (if QueryString = "" then "" else "?" & QueryString), Options = [ Headers = [ Authorization = "Bearer " & Token, #"Harvest-Account-ID" = AccountID, #"User-Agent" = "PowerBI" ] ], RawData = Web.Contents(FullUrl, Options), Json = Json.Document(RawData) in Json,Better solution - Make credentials recognizable:
Power BI needs to recognize the data source. Try this approach:
GetJson = (RelativePath as text, PageNum as number) => let Options = [ Headers = [ Authorization = "Bearer " & Token, #"Harvest-Account-ID" = AccountID, #"User-Agent" = "PowerBI" ] ], FullUrl = "https://api.harvestapp.com" & RelativePath & "?page=" & Number.ToText(PageNum), RawData = Web.Contents(FullUrl, Options), Json = Json.Document(RawData) in Json,Also check: In Power BI Service, go to Settings → Data source credentials and ensure your API token parameter is configured as a dataset parameter with proper credentials set.
Best regards!
PS: If you find this post helpful consider leaving kudos or mark it as solution
- Royel
Super User
Hi bebeben10 Power BI Service dose not support dynamic parameters in Web.Contents however it works fine in Power BI Desktop.
Instead of using BaseUrl as a variable use it as a literal string.
Update your Web.Contents with this
GetJson = (RelativePath as text, QueryParameters as record) => let RawData = Web.Contents( "https://api.harvestapp.com", [ Headers = [ Authorization = "Bearer " & Token, #"Harvest-Account-ID" = AccountID, #"User-Agent" = "PowerBI" ], RelativePath = RelativePath, Query = QueryParameters ] ), Json = Json.Document(RawData) in Json,Here is other similar solutions from community:
Thanks
- AnonymousNot applicable
- AnonymousNot applicable
Hi bebeben10
May I check if this issue has been resolved? If not, Please feel free to contact us if you have any further questions.
Thank you