CALCULATE in Power BI: how it changes the filters on your numbers
A plain-English guide to the most important DAX function: what filter context is, how CALCULATE replaces or keeps filters, and how to build a percentage of total.
When you are learning Power BI or Fabric, it is natural to edit a report in the same place everyone else looks at it. That works until a change breaks a measure on a Monday morning and the whole team sees the error at once.
Professional teams avoid this by keeping separate copies for building, checking and using their work. In Microsoft Fabric, the built-in tool for this is the deployment pipeline. This guide explains how deployment pipelines work, what gets copied when you deploy, and the settings that most often catch beginners out.
Microsoft's overview of deployment pipelines describes them as a tool for moving content between stages. A pipeline can have from two to 10 stages, and the default is three: Development, Test and Production.
Each stage is linked to one workspace. The development workspace is where you build. The test workspace is where a small group checks the changes. The production workspace is the one the business actually uses.
You can rename, add or delete stages while you create a pipeline. Microsoft's getting started guide warns that the number of stages and their names are permanent once the pipeline is created, so decide on them first.
Development stage
Test stage
Production stage
Microsoft's getting started guide lists a Fabric subscription and being an admin of a Fabric workspace as prerequisites. With those in place, the basic steps are:
You don't need to start with empty workspaces. When you assign a workspace that already has content, Fabric pairs the items it finds with matching items in the next stage.
Pairing links an item in one stage with the same item in the next stage. Microsoft's overview says pairing happens when you assign a workspace to a stage.
Paired items are overwritten when you deploy, which is what you want: the production report is updated with the new version. Paired items also stay paired if you rename them.
This matters because unpaired items behave differently. If an item in the target stage has the same name, type and folder but isn't paired, deploying doesn't overwrite it. Instead, Microsoft says a duplicate copy is created. If you suddenly see two reports with the same name in production, check the pairing first.
This is the part that surprises most beginners. Microsoft's page on the deployment process says that for semantic models, data isn't copied, only metadata. Metadata means the design: tables, columns, relationships and measures.
After the first deployment to an empty stage, you need to refresh the semantic models in that stage before reports show numbers. On later deployments, Microsoft says the data in the target is kept when possible. A full refresh is needed after breaking schema changes or a change to the data source connection.
Several settings are also not copied, so they stay with each stage:
What a deployment does with a semantic model
| part | deployed? | what to do |
|---|---|---|
| Model definition (tables, measures, relationships) | Yes | nothing, it is copied over |
| The data itself | No | refresh the model in the target stage |
| Data source credentials | No | set them once in the target stage |
| Refresh schedule | No | set it once in the target stage |
| Workspace roles and permissions | No | manage access per workspace |
This is helpful once you understand it. Production keeps its own credentials, schedule and access list, so deploying a new measure doesn't change who can see the report.
Usually you want development and test to use test data, and production to use live data. Changing the connection by hand after every deployment is slow and easy to forget. Deployment rules do it for you.
Microsoft's guide to creating deployment rules lists three kinds:
Semantic models and Dataflow Gen1 support both data source and parameter rules. Paginated reports and mirrored databases support data source rules. Notebooks support default lakehouse rules.
Three details are worth remembering:
You don't have to deploy everything at once. Microsoft's deployment process page says you can select which items to deploy, for example one updated report and the semantic model it depends on.
Before deploying, you can compare the content of two stages to see what has changed. Microsoft's CI/CD overview lists content comparison as part of deployment pipelines. Making this a habit is the simplest way to avoid surprises in production.
Microsoft also notes that content normally moves forwards. Backward deployment is only possible when the target stage is empty, so fix problems in development and deploy them forwards again.
Fabric has a second lifecycle tool: Git integration. Microsoft's introduction to CI/CD in Fabric explains that Git integration syncs a workspace with a repository in Azure DevOps or GitHub, giving you version history and a way for several developers to work together.
The two tools solve different problems. Git integration tracks versions of your work. Deployment pipelines promote that work through stages. Microsoft describes using both: connect the development workspace to Git, then deploy from that workspace with a deployment pipeline.
If you are just starting out, deployment pipelines are the easier first step. Add Git once you are comfortable.
A deployment pipeline gives you a safe place to make mistakes. You build in development, check in test, and only then deploy to production.
Remember the three things that catch beginners out: deploying copies the design, not the data; credentials, schedules and permissions stay with each stage; and deployment rules only apply on the next deployment. Learn those, and you will be working the way professional data teams do.
Free every Friday
Join our free live class every Friday at 6pm UK time: hands-on lessons, live Q&A and career tips from a working Senior Data Analyst.
Keep reading
A plain-English guide to the most important DAX function: what filter context is, how CALCULATE replaces or keeps filters, and how to build a percentage of total.
A simple SQL query that sorts every customer into active, at risk, lapsed or never ordered, so you know who to contact before they're gone for good.
What OneLake shortcuts are, which sources they can point to, and when a shortcut beats copying data into Microsoft Fabric for your business.
The Data Brief
New guides on Power BI, Fabric and SQL, plus class and cohort dates first. Free, and you can unsubscribe any time.