Texas A&M UniversityWork In Progress

Why we version-control JSON instead of clicking — the motivation for code-first Power BI development, what changes in your workflow, and when the visual editor is still the right tool.

Why Code-First?

If you've used Power BI Desktop, you know the workflow: open the app, click visuals, drag fields, format in the pane. It works. So why does TAMU's AggieViz system generate reports from code instead?

Key Insight
Click-and-drag doesn't scale to 20 reports with 1,149 visuals that need to look identical

The Problem at Scale

One report with 5 visuals? Desktop is perfect. Twenty reports with 48 pages and 1,149 visuals that all need to:

  • Use the same exact maroon (#500000) header bar at y=0, width=1280, height=50
  • Place a gold accent line at y=50, height=3, color=#A08035
  • Position navigation pills at x=400 with 108px spacing
  • Apply the same theme-responsive colors that switch between light and dark mode
  • Maintain pixel-perfect alignment across every page

Doing this by hand means clicking through 1,149 formatting panes. Missing one visual means one page looks different. Updating the brand color means touching every report, every page, every visual.

What Code-First Gives You

BenefitManual (Desktop)Code-First (PBIR/TMDL)
ConsistencyHuman-dependentGuaranteed by template
Brand updateTouch every visualChange one variable, regenerate
Audit trail"Who changed this?" → unknownGit blame → exact commit
ReviewCompare .pbix files (impossible)PR diff on JSON text
Rollback"Undo" in Desktop (limited)git revert to any point
AutomationOne report at a timeScript generates 20 reports in minutes
CollaborationLast-save-winsGit merge + PR review

When Desktop Is Still Right

Code-first doesn't replace Desktop — it replaces the production pipeline:

TaskUse DesktopUse Code-First
Exploring data, prototyping visualsYesNo
One-off ad hoc analysisYesNo
Designing a new page layoutYesNo
Producing 20 standardized reportsNoYes
Updating brand colors across all reportsNoYes
Deploying to staging → productionNoYes
Reviewing changes before publishingNoYes (PR review)

The workflow: Prototype in Desktop → codify the pattern → generate production reports from code → deploy via CI/CD.

What "Code-First" Actually Looks Like

You're editing JSON files in VS Code instead of clicking in the formatting pane:

Visual Editor (Desktop):

Open formatting pane → Background → Color → #500000 → Border → On → Width → 1 → Radius → 8 → ...

Code-First (PBIR JSON):

{
  "visual": {
    "visualContainerObjects": {
      "background": [{
        "properties": {
          "color": { "solid": { "color": "#500000" } }
        }
      }],
      "border": [{
        "properties": {
          "show": { "expr": { "Literal": { "Value": "true" } } },
          "width": { "expr": { "Literal": { "Value": "1D" } } },
          "radius": { "expr": { "Literal": { "Value": "8L" } } }
        }
      }]
    }
  }
}

The JSON is more verbose — but it's diffable, reviewable, and scriptable. When you need to change that #500000 to #4A0000, you change it in one place and regenerate.

The AggieViz Pipeline

Template (JSON patterns)
    │
    ├── Shell (header, footer, nav pills, theme slicer)
    ├── Visual defaults (fonts, colors, spacing)
    └── Page templates (KPI page, table page, trend page)
    │
    └── Generator script
            │
            ├── Report 1 (20 pages, 57 visuals)
            ├── Report 2 (20 pages, 57 visuals)
            ├── ...
            └── Report 20 (20 pages, 57 visuals)
                    │
                    └── Git commit → CI validation → Deploy to Fabric

See the AggieViz documentation for the full system.

Getting Started with Code-First

  1. Start at Level 1 — build reports in Desktop first. Understand visuals, DAX, and data modeling.
  2. At Level 3, learn Git Sync — see how Desktop work serializes to TMDL/PBIR.
  3. Start reading PBIR files — open the Git-synced JSON and find your visuals.
  4. Make small edits in VS Code — change a color, commit, see the result in the workspace.
  5. At Level 4, study the Shell Visual System and PBIP Property Reference for full automation.

What gets synced, conflict resolution, TMDL/PBIR files

The full automated report generation system

JSON property reference for every visual type