Nov. 21, 2025

From Goblin Script to Governance: Refactoring Hundreds of Power BI Measures with PBIP, TMDL, and Git

From Goblin Script to Governance: Refactoring Hundreds of Power BI Measures with PBIP, TMDL, and Git

You open Power BI and see measure names like M1, rev_calc1, and TestFinal2. This journey from goblin script to governance starts with a common problem. Messy models slow you down. Messy models make you question your own numbers. You see confusion get worse. Productivity goes down. Teams stop trusting their own insights.

  • Without clear governance, Power BI models have trouble giving value.

  • Problems with structure and unclear ownership stop good analytics.
    Picture a workspace where you treat your semantic model like code. PBIP, TMDL, and Git help you take control. They let you build a Power BI environment that is easy to keep up and good for teams.

Key Takeaways

  • Messy Power BI models make work slow. They also make people trust data less. Clear names and good organization help people use analytics well.

  • Cleaning up measures by hand does not work for big jobs. Use PBIP and TMDL to manage Power BI models. These tools help you track changes easily.

  • Follow a refactoring loop. First, export to PBIP. Next, edit in Visual Studio Code. Then, commit changes in Git. Last, check your model to make sure it is correct.

  • Use clear naming rules and folder setups. This makes measures easy to find. Add domain prefixes and grain suffixes to help people understand.

  • Use tools like Git and AI helpers to work together better. These tools help make documentation easier. They also help keep Power BI models organized and trustworthy.

Goblin Script to Governance: The Real Cost of Messy Measures

Productivity and Trust Issues

You might think a few confusing measure names do not matter. In reality, they slow you and your team down every day. When you open a model and see names like M1 or rev_calc1, you waste time trying to figure out what each measure means. You ask teammates for help or search through old emails. This confusion grows as more people use the model.

Many organizations face these problems. Teams spend hours searching for the right data. They do not know who owns each measure. During a cloud migration at a fintech company, the data team could not trust their data sources. They struggled to find the correct datasets. This lack of trust delayed important decisions and made everyone less productive.

When you cannot trust your model, you create new measures instead of reusing existing ones. This leads to duplicate logic and even more confusion. The cycle repeats, and your model becomes harder to use. The journey from Goblin Script to Governance starts when you recognize these hidden costs.

Why Manual Cleanup Fails

You may try to fix messy models by renaming measures in Power BI Desktop. This works for a few changes, but it does not scale. If you have hundreds of measures, manual cleanup becomes a nightmare. You risk breaking reports or losing track of what you changed.

Manual fixes do not give you a clear history of changes. You cannot see who made edits or why. If something breaks, you cannot easily roll back to a safe version. Without a better process, you stay stuck in the goblin script stage. Goblin Script to Governance means moving past slow, risky fixes and choosing tools that help you clean up at scale.

PBIP and TMDL: Unlocking Your Model

From PBIX Black Box to PBIP Project

You may feel stuck when you work with a PBIX file. The PBIX format hides your model inside a single file. You cannot see what changed or who made edits. Searching for a measure or comparing versions becomes hard. You cannot safely make bulk changes. This is where PBIP helps you move from Goblin Script to Governance.

PBIP turns your Power BI project into a folder of readable files. You can open these files in tools like Visual Studio Code. You can search, compare, and track changes. You can use Git to manage versions. This means you can see every change, roll back mistakes, and work with your team. PBIP makes your model open and easy to manage.

TMDL: Your Model as Code

TMDL stands for Tabular Model Definition Language. It lets you see your model as text. You can edit measures, columns, folders, and formatting in one place. You can use scripts to rename hundreds of measures or move them into folders. You can fix colors or add descriptions in bulk.

TMDL also helps you use best practices. You can check your model for common problems. You can use AI assistants to help you write or check DAX queries. You can even use natural language to build or change parts of your model.

Here are some benefits you get when you treat your semantic model as code with PBIP and TMDL:

Benefit Description

Details

Build and Modify Semantic Models with Natural Language

You can ask AI assistants to create or manage model parts using simple language.

Bulk Operations at Scale

You can change many objects at once, saving time on repeated tasks.

Apply Modeling Best Practices

You can check and improve your model with less effort.

Agentic Development Workflows

You can plan and run complex tasks more easily.

Query and Validate DAX

You can test and fix DAX queries faster, making your data more reliable.

With PBIP and TMDL, you move from a locked-down file to a flexible, team-friendly project. This is a key step in the Goblin Script to Governance journey.

The Refactoring Loop: Clean Up at Scale

Export, Edit, Commit, Validate

You can clean up many Power BI measures without getting stressed. The trick is to use a simple loop that keeps your work safe. This loop helps you go from messy to organized.

Here is how you do it:

  1. Export your PBIX to PBIP
    First, change your PBIX file into a PBIP project. This lets you see your model as text files. You can look at every measure, table, and folder.

  2. Edit in VS Code
    Open your PBIP project in Visual Studio Code. You can search for measure names and use find-and-replace. You can run scripts to rename, move, or delete measures. Tools like measure_operations and batch_measure_operations help you do many changes at once. You can also use AI assistants to help with tables, columns, and relationships.

  3. Commit your changes in Git
    Make a new branch for your cleanup work. Edit your files and save your changes in Git. This step keeps a record of every change. You can see what changed and when.

  4. Validate your model
    Open your PBIP project in Power BI. Test your main reports. Make sure nothing is broken. If you find a problem, you can go back to a safe version with Git.

Tip: Always use branches and pull requests for cleanup. This keeps your main project safe. Your team can check changes before adding them.

You can do this loop every time you refactor. You do not have to worry about losing work or breaking reports. Git protects your work at every step.

Naming and Foldering Patterns

Clear names and folders make your model easy to use. Your team can find the right measure quickly. New users can learn the model faster.

Before-and-after examples show the difference:

Before

After

M1, rev_calc1, TestFinal2

Sales_Total, Finance_Rev_Monthly, Ops_Headcount_YTD

No folders, all measures in one list

Sales\KPIs, Finance\Ratios, Ops\Headcount

You can see the new names use domain prefixes and grain suffixes. Display folders group similar measures together. This makes your model steady and easy to understand. Your team knows where to look and what each measure means.

Best practices for naming and foldering:

  • Use prefixes for domains: Sales_, Finance_, Ops_, HR_

  • Add suffixes for grain: _Daily, _Monthly, _YTD, _YoY

  • Make display folders: Sales\KPIs, Finance\Ratios, Ops\Headcount

  • Keep names short and clear

  • Do not use random names like TestFinal2

Note: Using the same naming and foldering rules keeps your model on track. These patterns help AI assistants and team members work better with your model.

Tools and resources for large-scale refactoring:

  • measure_operations helps you manage single DAX measures. You can create, update, delete, rename, and move measures.

  • batch_measure_operations lets you change many measures at once. You can rename or move lots of measures quickly.

  • AI assistants can help you build and change semantic models with natural language. You can use best practices and run batch changes on many objects.

You can use a test-first workflow to make your logic clear. This keeps your model easy to fix and understand. When you use files and folders the same way every time, your model stays correct.

You move from Goblin Script to Governance by using this loop. You build a model that is steady, easy to use, and good for your team.

Governance, Copilot, and Guardrails

Naming Standards That Work

Clear naming and folder rules help keep your Power BI model neat. You can use a cheatsheet to help your team follow the rules:

Pattern

Example

Domain Prefix

Sales_, Finance_, Ops_, HR_

Grain Suffix

_Daily, _Monthly, _YTD, _YoY

Display Folder

Sales\KPIs, Finance\Ratios

You can put measures into groups by domain and time. This makes it easy for people to find what they need. Display folders help cut down on clutter. New team members can learn the model faster.

Copilot for Documentation

Copilot in Power BI helps you write measure descriptions fast. You can ask Copilot to explain hard KPIs or turn business questions into clear visuals. Teams save time when Copilot makes standard explanations. You can make these descriptions better with simple edits. Copilot also helps you change reports and measures with easy steps.

  • You spend less time making reports.

  • You get quicker answers with clear KPI details.

  • You make fewer mistakes because Copilot does repeat jobs.

You should always check Copilot’s ideas. Human review makes sure your documentation is right and honest.

Pitfalls and Safe Practices

You can avoid mistakes by using safe steps. Always use Git branches when you make changes. Do not make quick fixes in Power BI Desktop without version control. This keeps your model safe and easy to check.

Feature

Benefit

Native Git Integration

You can control versions of models and dashboards.

Standard Workflows

You can track changes and manage versions easily.

Collaboration

You can make changes in a safe way and keep data correct.

Guardrails like automatic checks and approval steps help you follow good rules. Central governance helps keep your data high quality. Companies that use these guardrails spend less time on reports and trust their data more.

You move from Goblin Script to Governance by using these rules, tools, and steps. You build a model that is easy to manage and ready to grow.

You saw how Goblin Script to Governance helps teams work better. Clear rules and automatic steps help everyone trust the data. PBIP, TMDL, and Git make models simple to manage. Try changing one PBIX to PBIP and fix a few measures. To grow governance, follow these steps:

  1. Set up roles for data governance.

  2. Make a map of your data.

  3. Create a glossary for business terms.

  4. Keep data safe and sort it.

  5. Show how data moves.

  6. Use access based on roles.

  7. Check data health often.

  8. Add governance to all projects.

  9. Match with Data Mesh ideas.

  10. Build a strong governance culture.

Strategy Component

Description

CI/CD Architecture

Keeps models safe and tracks versions.

Branching Strategy

Lets you add new features safely.

Pull Request + Code Review

Checks for quality before changes are added.

Merge into Main Branch

Starts deployment and keeps the main version steady.

FAQ

What is PBIP and why should you use it?

PBIP turns your Power BI file into a folder of readable files. You can see changes, track versions, and work with your team. PBIP helps you keep your model organized and safe.

How does TMDL help you refactor measures?

TMDL lets you see your model as text. You can rename, move, and update measures quickly. You can use scripts to make changes in bulk. TMDL saves you time and reduces mistakes.

Can you use Git with Power BI projects?

Yes! Git lets you track every change. You can create branches, review edits, and roll back mistakes. Your team can work together without fear of breaking reports.

What naming pattern works best for measures?

Pattern

Example

Domain Prefix

Sales_, Finance_, Ops_

Grain Suffix

_Monthly, _YTD, _YoY

You should use clear names. This helps everyone find the right measure fast.