BI with Moiz

PBIR is the default: find the data values your report files commit to Git

PBIR report files can store filter and slicer values from your semantic model. Find them, block the ones you never want in Git, and check your history.

11 min readPower BIDatabase Development & DevOpsMicrosoft Fabric

Filter a visual to one customer, save the report, and that customer's name can land in your Git repository. This article shows where PBIR stores those values, how to list them with a short Python script, how to block the ones you never want on main before a pull request merges, and how to check your history for them.

Who this is for

Power BI developers and Fabric teams who keep reports in Git, either as Power BI projects (PBIP) saved from Desktop or through Fabric Git integration. If nobody on your team commits reports yet, keep this for the day you start.

Why this matters now

PBIR is generally available and is the default report format. Two things in Microsoft's documentation make that relevant to every team with reports in Git:

  • When you edit and save a PBIR-Legacy report, Power BI silently and automatically converts it to PBIR.
  • Fabric Git integration and the Fabric REST APIs export report definitions using PBIR.

So nobody has to choose the moment of the format change. The next person who edits an older report and saves it produces PBIR, and the next sync to Git commits it.

The same page also says this:

Some report metadata files, such as visual.json or bookmarks.json, can be saved with data values from your semantic model. For instance, if you apply a filter to a visual for the field 'Company' = 'Contoso', the value 'Contoso' will persist as part of the metadata.

It adds that the same applies to slicer selections, matrix custom column widths and formatting for specific series. Microsoft's page gives no guidance on which values are fine to commit, which makes sense: that depends on your data.

My read: once a value is in a file, repository permissions decide who can read it. Row-level security in the semantic model has no say over a cloned repository. A customer name in a filter is usually harmless inside the team that built the report; the question is who else can clone that repo, today and after the next reorganisation.

Where the values sit

PBIR splits a report into one file per page, visual and bookmark under the definition/ folder. Abridged, with the files that hold filters marked:

Sales.Report/
└── definition/
    ├── bookmarks/
    │   ├── [bookmarkName].bookmark.json ← bookmark filters
    │   └── bookmarks.json
    ├── pages/
    │   ├── [pageName]/
    │   │   ├── visuals/
    │   │   │   └── [visualName]/
    │   │   │       ├── mobile.json
    │   │   │       └── visual.json    ← visual filters, slicer state
    │   │   └── page.json              ← page-level filters
    │   └── pages.json
    ├── report.json                    ← report-level filters
    ├── reportExtensions.json
    └── version.json

Microsoft's file table describes report.json, page.json and the bookmark files as holding filters at their level, and visual.json as holding the visual's metadata and query. Every PBIR file also declares a public JSON schema at the top, and the schemas are published in the microsoft/json-schemas repository on GitHub.

The schemas tell you what to look for. Filters are stored in a filterConfig object, and each filter condition is a small query (In, Comparison and so on). Wherever a condition compares a column to a value, that value is stored as a Literal with a Value string. The schema lists the encodings: integers end in L (24L), doubles in D, decimals in M, dates start with datetime', and booleans and nulls are true, false and null. Text values are the ones that can name a customer, a person or a product.

Where a filter value travels: from a report filter, through the silent PBIR conversion, into visual.json and the Git repository

Step 1: List every text value in your report files

The script below walks every JSON file in a report folder, finds every Literal value at any depth, and prints the text values with the file and the JSON path where each one sits. It skips three kinds of noise:

  • numbers, dates, booleans and nulls;
  • formatting, because fonts, colours and alignment are stored as Literal values too ('Segoe UI', '#118DFF'), inside a visual's objects or visualContainerObjects;
  • except under a selector (per-series formatting points at a specific data value there) or a filter/Condition (slicer selections are typically stored there; see the note below the sample output), so those are kept.

Searching at any depth matters because values also appear outside filters, in slicer state and bookmark snapshots. Text values escape a single quote by doubling it ('O''Brien'); the script turns that back into O'Brien before comparing.

Save it as scripts/find_pbir_literals.py:

#!/usr/bin/env python3
"""List the text values saved in PBIR report files; fail on terms you never want committed."""
import argparse
import json
import pathlib
import sys
 
 
def find_literals(node, where=""):
    """Yield (json_path, value) for every Literal.Value string in a PBIR JSON document."""
    if isinstance(node, dict):
        literal = node.get("Literal")
        if isinstance(literal, dict) and isinstance(literal.get("Value"), str):
            yield where, literal["Value"]
        for key, child in node.items():
            yield from find_literals(child, f"{where}/{key}")
    elif isinstance(node, list):
        for i, child in enumerate(node):
            yield from find_literals(child, f"{where}[{i}]")
 
 
def is_text(value):
    """Skip numbers (24L, 2.4D, 2.4M), dates, booleans and nulls; keep text."""
    v = value.strip()
    if v in ("true", "false", "null", "") or v.startswith("datetime'"):
        return False
    if v[-1] in "LDM":
        try:
            float(v[:-1])
            return False
        except ValueError:
            pass
    return True
 
 
def is_formatting(where):
    """Formatting (fonts, colours, alignment) is stored as Literals too.
 
    Inside formatting objects, keep selectors (per-series formatting) and filters
    (a slicer keeps its selection there); skip everything else.
    """
    in_objects = "/objects/" in where or "/visualContainerObjects/" in where
    keep = ("/selector/", "/filter/", "/Condition/")
    return in_objects and not any(k in where for k in keep)
 
 
def unquote(value):
    if len(value) > 1 and value[0] == value[-1] == "'":
        return value[1:-1].replace("''", "'")
    return value
 
 
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("paths", nargs="+", help="*.Report folders or individual JSON files")
    parser.add_argument("--deny", help="text file, one term per line, that must never be committed")
    args = parser.parse_args()
 
    deny = []
    if args.deny:
        lines = pathlib.Path(args.deny).read_text(encoding="utf-8").splitlines()
        deny = [t.strip().lower() for t in lines if t.strip() and not t.startswith("#")]
 
    files = []
    for p in map(pathlib.Path, args.paths):
        if p.is_dir():
            files += sorted(p.rglob("*.json"))
        elif p.suffix == ".json" and p.exists():
            files.append(p)
 
    hits = 0
    for f in files:
        try:
            doc = json.loads(f.read_text(encoding="utf-8-sig"))
        except (json.JSONDecodeError, UnicodeDecodeError):
            continue
        for where, raw in find_literals(doc):
            if not is_text(raw) or is_formatting(where):
                continue
            value = unquote(raw)
            denied = any(term in value.lower() for term in deny)
            hits += denied
            print(f"{'DENIED' if denied else 'ok':6}  {f}  {where}  {value}")
 
    if hits:
        print(f"\n{hits} denied value(s) found. Remove the filter, slicer selection or bookmark state, then save again.")
        sys.exit(1)
 
 
if __name__ == "__main__":
    main()

Run it against a report folder:

python scripts/find_pbir_literals.py Sales.Report

On a sample report with a visual filtered to Contoso, a series coloured for one customer, a slicer set to Northwind Traders, a page filtered to West and a bookmark that captured a filter, a run with a deny list (Step 2) prints this (JSON paths shortened):

DENIED  Sales.Report/definition/bookmarks/b1.bookmark.json  .../In/Values[0][0]  Fabrikam Ltd
ok      Sales.Report/definition/pages/a1b2/page.json  /filterConfig/filters[0]/.../Values[0][0]  West
ok      Sales.Report/definition/pages/a1b2/visuals/s01/visual.json  /visual/objects/general[0]/properties/filter/.../Values[0][0]  Northwind Traders
DENIED  Sales.Report/definition/pages/a1b2/visuals/v01/visual.json  /visual/objects/dataPoint[0]/selector/.../Right  O'Brien Supply
DENIED  Sales.Report/definition/pages/a1b2/visuals/v01/visual.json  /filterConfig/filters[0]/.../Values[0][0]  Contoso
 
3 denied value(s) found. Remove the filter, slicer selection or bookmark state, then save again.

The fonts and colours in those visuals don't appear: they are formatting. Microsoft's page doesn't document where a slicer stores its selection; the sample follows the layout commonly seen in PBIR slicer files, so confirm it on one of your own slicers first.

That sample folder was built by hand from Microsoft's published schemas, so run the script on a copy of one of your own reports before you rely on it. If it prints nothing for a report you know is filtered, open that report's visual.json and compare the filter's shape with the schema.

Read the list as a team. Most values will be fine (regions, years, product categories), and the few that aren't are easier to talk about before a pull request is waiting on them.

Step 2: Agree the rule and write it down

Write down two things:

  1. A short written rule in the repository's README or contributing guide: which kinds of values may be committed in report files (for example, regions and categories yes, customer and employee names no).
  2. A deny list of terms that must never appear, one per line. The script compares case-insensitively and matches substrings, so contoso also catches Contoso West.

Don't commit the deny list itself if the terms on it are the sensitive part. In the pipeline below it comes from a secret.

Step 3: Check every pull request

Be clear about what this check does. By the time a pull request runs, the value is already committed on the source branch; the check stops it from reaching your main branch, and a blocked value still has to be removed from that branch (save the report without it and push again). That only works if report changes arrive through pull requests, so connect Fabric workspaces you develop in to a feature branch rather than to main: Fabric Git integration commits to whichever branch the workspace is connected to.

Scan only the report files a pull request adds, changes or renames, so the check stays fast and the output stays readable. This GitHub Actions workflow does that; an Azure Pipelines job can run the same shell lines.

name: pbir-values
on:
  pull_request:
    paths:
      - "**/*.Report/**"
 
jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
        with:
          fetch-depth: 0
      - uses: actions/setup-python@v6
        with:
          python-version: "3.12"
      - name: List values saved in changed report files
        shell: bash
        env:
          PBIR_DENY: ${{ secrets.PBIR_DENY }}
        run: |
          [ -n "$PBIR_DENY" ] || { echo "PBIR_DENY secret is empty"; exit 1; }
          printf '%s\n' "$PBIR_DENY" > "$RUNNER_TEMP/deny.txt"
          git diff -z --name-only --diff-filter=d "origin/${{ github.base_ref }}...HEAD" -- '*.Report/*.json' \
            | xargs -0 -r python scripts/find_pbir_literals.py --deny "$RUNNER_TEMP/deny.txt"

A few details that matter:

  • fetch-depth: 0 fetches the full history so the base branch exists for the diff.
  • shell: bash runs the step with pipefail, so a failing git diff fails the job instead of passing an empty file list.
  • The empty-secret guard matters because pull requests from forks don't receive repository secrets; without it, an empty deny list would pass everything. Fork pull requests fail on purpose, and a maintainer re-runs the check from a branch inside the repository.
  • --diff-filter=d scans everything except deletions. A narrower filter such as AM would skip a renamed report.
  • -z with xargs -0 keeps report folders with spaces in their names intact.
  • In Git's default pathspec matching, * also matches /, so '*.Report/*.json' covers every JSON file at any depth inside a .Report folder.
  • When a denied term is found the script exits with 1, xargs returns a non-zero code and the check fails.

The check prints every non-formatting text value it finds, including the allowed ones. A reviewer can read in one place which data values the change commits, without opening each visual file, and that list is the backstop for names nobody has added to the deny list yet.

If you save PBIP projects from Desktop and commit locally, you can run the same check earlier, before the commit exists. Save this as .git/hooks/pre-commit and make it executable:

#!/bin/sh
[ -f "$HOME/.pbir-deny.txt" ] || exit 0
git diff --cached -z --name-only --diff-filter=d -- '*.Report/*.json' \
  | xargs -0 -r python3 scripts/find_pbir_literals.py --deny "$HOME/.pbir-deny.txt"

Hooks aren't shared through the repository and anyone can skip them, so treat the hook as a convenience and the pull request check as the rule. The hook reads the files in your working folder, which match what you staged as long as you stage after saving.

Step 4: Search the history you already have

A rule from today doesn't clean what was committed last month. Git's pickaxe search lists every commit that added or removed a term:

git log --all --oneline -i -S "contoso" -- "*.json"

-S looks for changes in the number of occurrences of the string, so it finds both the commit that introduced a value and the one that removed it. -i makes it case-insensitive. To see which files contain the term in any revision:

git grep -i -l "contoso" $(git rev-list --all) -- "*.json"

On a large repository the second command can be slow; run it per term from your deny list.

If a value you don't want shows up, decide before acting. Removing it from history means rewriting history, which changes commit hashes and affects everyone with a clone. GitHub's guide to removing sensitive data recommends git-filter-repo (version 2.47 or later, with --sensitive-data-removal), notes that copies in forks remain accessible, and says GitHub Support can remove cached views and pull request references. For a customer name, tightening who can read the repository may be the proportionate fix. For anything you'd treat as a secret, follow that guide.

Gotchas and limits

  • Older formats. Microsoft's page doesn't say whether PBIR-Legacy report.json stored the same values. Don't assume older commits are clean; Step 4 checks them.
  • Automatic filters. Visual automatic filters are written to visual.json only after the filter pane has been expanded at least once while editing. A report can start committing values later than you expect.
  • Values outside filters. Microsoft names slicer selections, matrix column widths and series formatting. The script searches every Literal at any depth and keeps selectors inside formatting; a value stored in some other shape would be missed, so read a few visual.json files by hand the first time.
  • A deny list only catches what you list. New customers won't be on it. The full printed list in every pull request is the backstop.

What to check in your own setup

  • Which reports in your repositories are already PBIR (a definition/ folder with version.json)?
  • Who can clone each repository that holds reports, and does that match who may see the data in them?
  • Is there a written rule for which values may be committed in report files?
  • Does every pull request that touches a .Report folder run a values check?
  • Have you searched the history for the names you'd never want in Git?

Summary

PBIR gives every visual its own file, and those files can carry filter and slicer values from your model into Git. Start with Step 1 on your largest report: the list it prints tells you whether you need the rest of this article this week or next quarter.

Sources

Checked 5 November 2026.

Hiring for Power BI, Fabric or AI on governed data?

Let's talk about the role, or compare notes on an approach. LinkedIn is the fastest way to reach me.