Forum Discussion
An error occurred while processing the data in the semantic model.
- 1 year ago
I think you are right that the most likely issue is the API itself. Even if the developer is skeptical, it’s common for publicly accessible APIs to intermittently:
- Throttle requests (rate limiting).
- Fail due to timeout or heavy load.
- Return malformed or incomplete responses.
The fact that re-entering the same credentials "resolves" the issue supports this; your manual refresh is essentially retrying the call, which eventually succeeds.
Anonymous APIs often lack SLA guarantees or proper headers, and Power BI doesn’t retry Web.Contents fetches automatically.
The other likely situation is a service timeout. If the API call is complex (e.g., has dynamic parameters, headers, or paging logic), Web.Contents may not fully fold or may exceed timeout thresholds.
If you are ingesting straight into a semantic model, I would encourage you to set up your ETL through dataflows and then ingest those flows into the semantic model. At a minimum this will isolate the refresh failures to the query and not make the whole model refresh fail.
You could also try to wrap Web.Contents with a try...otherwise
let Source = try Web.Contents("https://your.api.url/endpoint") otherwise null in Source
Please mark this post as a solution if it helps you. Appreciate Kudos.
mgray1998
Possible long-term fixes:
-
Use a proper Authentication method (if available)
-
If the API supports a key/token, switch from anonymous to that.
-
Tokens often refresh automatically or have longer validity.
-
Cache or stage API data in a database or data lake
-
Instead of Power BI calling API every refresh, build a scheduled ETL process (e.g., Azure Data Factory, Logic Apps) to pull API data and save it in SQL or Blob storage.
-
Power BI then reads from that stable data source, reducing API failures.
-
Set Privacy Levels Carefully
-
Ensure all sources involved use compatible privacy levels.
-
Avoid mixing Public with Organizational or Private sources in the same query.
-
Error handling in M Query
-
Use
try ... otherwise to handle API errors gracefully and avoid refresh failure. -
Example:
Source = try Web.Contents("your API URL") otherwise null -
This won’t fix the root cause but can avoid refresh breaks.
-
Scheduled Refresh Settings
-
If using Power BI Service, try to stagger refreshes to avoid API throttling.
-
Also consider incremental refresh to reduce load.
-
Monitor API health/logs
-
Track API uptime and response times (there are monitoring tools for this).
This helps argue with developers if the API really has issues.
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!
-
-
-
-
-
-