Sub topic 12
Inspecting and refreshing partitions through the XMLA endpoint
This chapter assumes you have published a model with an incremental refresh policy and run its first refresh. It also assumes you can sign in to a workspace on Premium capacity, Premium Per User, or a Fabric capacity. The Power BI service creates the partitions for you, but it doesn't show them. The XMLA endpoint does.
What the XMLA endpoint gives you
The XMLA endpoint is a connection address for a workspace. Tools that speak the Analysis Services protocol, such as SQL Server Management Studio (SSMS), Tabular Editor, or scripts, use it to connect to your semantic model. Through it you can:
- See each partition that the policy created.
- Check when each partition last refreshed.
- Refresh one partition without touching the others.
The endpoint needs read-only access to inspect and read-write access to refresh. An administrator enables read-write in the capacity settings.
Connecting from SSMS
- In the workspace settings, copy the workspace connection string. It looks like
powerbi://api.powerbi.com/v1.0/myorg/Sales Workspace. - In SSMS, choose Connect > Analysis Services.
- Paste the string as the server name and select Microsoft Entra ID authentication.
- Expand the model, then Tables. Right-click your fact table and choose Partitions.
The dialog lists one partition per period. Names follow the granularity: 2020 for years, 2020Q4 for quarters, 202011 for months, and 20201127 for days. The dialog also shows the last processed time for each partition.
Reading partition state with a query
Open a new MDX query window in SSMS, connected to the model, and run a schema query:
SELECT [Name], [State], [RefreshedTime]
FROM $SYSTEM.TMSCHEMA_PARTITIONSPartitions in the incremental window should show a recent RefreshedTime. Archive partitions should keep the time of the first refresh. If every partition shows the same recent time, the policy isn't skipping archive data. Check the folding problems from the troubleshooting chapter.
Refreshing a single partition
Suppose a late correction was loaded into the source for November 2020, and the partition is outside your incremental window. A normal scheduled refresh won't reload it. You can refresh that one partition with a TMSL script. Run it in an XMLA query window in SSMS:
{
"refresh": {
"type": "full",
"objects": [
{
"database": "SalesModel",
"table": "FactSales",
"partition": "202011"
}
]
}
}Only the named partition reloads. Power BI sends the same folded query it uses in normal refreshes, with that partition's date range substituted for RangeStart and RangeEnd.
Choosing between the service, XMLA, and the REST API
| Task | Best tool |
|---|---|
| Routine refresh on a schedule | Scheduled refresh in the service |
| Check which partitions exist and when they refreshed | SSMS partitions dialog or a schema query |
| Reload one old partition after a source correction | TMSL refresh through XMLA |
| Trigger refreshes from a pipeline with partition-level control | Enhanced refresh REST API |
Limits to remember
- Reading and refreshing partitions doesn't change the model. Editing metadata through XMLA does. For a model published from Desktop, a metadata edit means you can no longer download the .pbix file from the service. Keep your original file under source control.
- Publishing again from Desktop replaces the model, and the first refresh after that rebuilds all partitions.
- A custom partition you add by hand is not managed by the policy. Prefer to let the policy own the table's partitions.
Exercise
A source system corrected sales for March 2021, which is in the archive period of a policy that stores five years and refreshes the last ten days at day granularity. Scheduled refresh does not pick up the change. What is the least costly way to load the corrected data, and what is the partition name?
Show answer
Connect to the workspace's XMLA endpoint (read-write must be enabled) and run a TMSL refresh for only the March 2021 partition. Archive partitions in this policy are monthly, quarterly, or yearly depending on the policy's granularity. For a month partition the name is 202103. For a quarter partition it is 2021Q1, and for a year partition it is 2021. Check the name first in the Partitions dialog. Leave applyRefreshPolicy at its default so other partitions stay untouched.