Sub topic 1
From .pbix file to published report
Prerequisites
This chapter assumes you can:
- Build a simple report in Power BI Desktop, with a few visuals on one or more tables.
- Sign in to the Power BI service with a Microsoft work or school account.
- Tell a report (the pages and visuals) from the data behind it (the tables, relationships, and measures).
You don't need a workspace or a license yet. Later chapters cover both. This chapter explains what you are publishing and what the service does with it.
What a .pbix file is
A .pbix file is the file Power BI Desktop saves. It is a single package, internally a ZIP archive, that holds everything needed to reopen your work:
- Report layout: the pages, visuals, filters, and formatting.
- Queries: the Power Query (M) steps that load and shape your data.
- Data model: tables, relationships, measures, and hierarchies. In Import mode, it also holds a compressed copy of the data.
- Connection information: the data sources your queries use. Passwords are not stored in the file.
You can look inside the package yourself. The script below opens a copy of a .pbix read-only and lists its entries. Entry names vary by Desktop version and file format, so expect something like Report/Layout, DataModel, DataMashup, Connections, and Metadata.
Add-Type -AssemblyName System.IO.Compression.FileSystem
$path = (Resolve-Path '.\Sales.pbix').Path
$zip = [System.IO.Compression.ZipFile]::OpenRead($path)
try {
$zip.Entries | Select-Object FullName, Length | Format-Table -AutoSize
}
finally {
$zip.Dispose()
}Look at the Length of the DataModel entry. In an Import-mode report it is usually by far the largest item, because it holds the data. That entry is why a .pbix file can be a security concern and a size problem.
Related file types
| File | Contains | Typical use |
|---|---|---|
| `.pbix` | Report, queries, model, and (for Import) data | Normal authoring and publishing |
| `.pbit` | Report, queries, and model definition, with no data | Sharing a starting point that others fill with their own data |
| `.pbip` | A folder of text-based project files | Source control and team development |
This chapter and the scripts later in the tutorial work with .pbix. Desktop can publish a .pbip project too, but the upload tools in the automation chapter expect .pbix.
Two items, not one
The central idea for the whole tutorial is that one .pbix file becomes two things in the service:
- A report. The pages and visuals that people open.
- A semantic model. The tables, relationships, measures, and (for Import) the stored data. Older documentation and some menus call this a dataset. The name changed, but the concept did not.
The report reads from the semantic model. When you publish, Power BI splits the file along that line. This split explains most of the behavior you will meet later:
- Refresh schedules and credentials belong to the semantic model, not the report.
- Several reports can share one semantic model.
- Replacing a report does not by itself change who can see the underlying data.
How the storage mode changes what is uploaded
What gets uploaded depends on how the report connects to its data. The mode is set when you build the report.
| Mode | What the .pbix holds | What publishing creates |
|---|---|---|
| Import | Model plus a copy of the data | Report and a new semantic model with the data snapshot |
| DirectQuery | Model definition only, with no data copy | Report and a new semantic model that queries the source at view time |
| Live connection | Report only, pointing at an existing semantic model | Report only, bound to the existing semantic model |
Some points follow from the table:
- Import gives fast visuals because the data sits in the service. The data goes stale until a refresh runs, and the first published copy is only as current as your last refresh in Desktop.
- DirectQuery keeps the file small, but every interaction sends queries to the source. The source must be reachable from the service, which is where gateways come in (see the chapter on data source credentials).
- Live connection is how you build a "thin report" on a semantic model someone else maintains. Publishing a thin report does not create a second copy of the model. It also means you cannot edit the model from that file.
A single report can mix Import and DirectQuery tables (a composite model), and the model then needs both kinds of handling. Treat that as an advanced case and first get a pure Import report working.
What happens when you publish
Publishing from Desktop is an upload plus a few service-side steps. In order:
- Desktop checks that you are signed in and asks you to pick a destination workspace.
- Desktop packages the file and uploads it. This is an import operation on the service side.
- The service creates, or updates, the report and the semantic model in that workspace.
- For Import mode, the service stores the data snapshot that was in the file.
- The service does not yet know how to log in to your data sources. Credentials are set afterward, and refresh stays unconfigured until you do that.
Step 5 surprises many people. The report opens right after publishing and shows the data from your last Desktop refresh. It looks healthy. The first scheduled or manual refresh then fails with a credentials error, because the service has never been told how to connect. The data credentials chapter fixes this.
The who, where, and how of publishing each have their own chapter. In brief:
- You need a role in the workspace that allows creating content (Contributor or higher).
- You need a license that allows publishing to that workspace.
- The destination is chosen in a dialog, and you can pick "My workspace," which is personal and not meant for sharing.
Size and structure limits that affect publishing
A few limits decide whether an upload succeeds. Check current numbers in Microsoft's documentation, because limits change.
- File size. Shared capacity (Pro) has a smaller upload limit than Premium or Fabric capacity. A very large Import model needs a capacity that allows large files, or a change in design such as DirectQuery or aggregations.
- Model size after loading. The compressed model in memory is capped by capacity, even if the file uploaded.
- Unsupported content. Some data sources, custom connectors, and features need a gateway or an admin setting before they work in the service.
If a publish fails on size, look at the DataModel entry from the earlier script. Removing unused columns, reducing high-cardinality text columns, and turning off Auto date/time often cut the model size more than any file-level fix.
A worked example
Suppose you have Sales.pbix, an Import-mode report over an Excel file and a SQL database. You publish it to a workspace named Sales Analytics.
- In Desktop, choose Home > Publish, sign in if asked, and pick
Sales Analytics. - When the upload ends, Desktop shows a link to open the report in the service.
- In the workspace, you see two new items named
Sales: one of type Report and one of type Semantic model. - You open the report and see data from your last Desktop refresh.
- You open the semantic model's settings and find a message that the data source credentials are not set. Until you fix that, refresh will fail.
That sequence, from file to two items to "works but cannot refresh yet," is the path every published Import report follows. The remaining chapters take each step in turn.
Common mistakes at this stage
- Expecting one item. Learners search the workspace for "the dataset" and miss it because the list shows the report and model as separate rows with the same name. Use the type column to tell them apart.
- Publishing from a stale file. Desktop publishes what is in the file. If you did not refresh in Desktop first, the service shows old data.
- Treating the file as safe to share. As the warning above says, the file contains data. Share the report through the service, not as an attachment.
- Publishing a thin report and trying to edit the model. A live-connected report has no local model. You change the shared semantic model at its source.
- Assuming credentials travel with the file. They do not. The service must be given them separately.
Exercise
You publish an Import-mode Sales.pbix to a workspace. The report opens and shows correct numbers. The next morning a colleague says the numbers have not changed since yesterday, and a refresh attempt fails. Which two items did publishing create, and what is the most likely cause?
Show answer
Publishing created a report and a semantic model. The report opens with the data snapshot that was in the file. The most likely cause is that data source credentials were never set on the semantic model, so refresh cannot sign in to the sources. The fix is to set credentials in the semantic model's settings (and configure a gateway if a source is on-premises), then run a refresh.
Exercise
A teammate builds a report with a live connection to a semantic model that already exists in the Sales Analytics workspace and publishes it. How many new items appear, and why can't the teammate change a measure in that file?
Show answer
One new item appears: the report. A live connection has no local model and no copy of the data, so publishing creates no new semantic model. The measure lives in the existing semantic model, so it must be changed there, by someone with permission to edit that model.