Author Image

CEO & Co-founder of Visivo

Modern Analytics with BI-as-Code for Scalable Data Systems

Explore how BI-as-Code transforms analytics into scalable, automated systems that grow with your organization.

BI-as-Code architecture diagram

Most BI teams spend their time maintaining dashboards by hand and arguing about which revenue number is right. BI-as-code is the way out. Grand View Research projects that "The global data analytics market will reach $684.12 billion by 2030," and hand-maintained analytics does not scale to that.

Manage analytics artifacts as code and they scale the way the rest of your software does.

What BI-as-code is

In BI-as-code, analysts and engineers define dashboards, metrics, and visualizations in code instead of clicking through a graphical interface. VentureBeat reports that "87% of data science projects never make it to production," and BI tooling that does not scale is often the reason.

This is not only automation. It is software engineering practice applied to analytics.

In traditional BI, a dashboard is a black box built in a proprietary interface. One person changes it, alone, usually without documentation or review. That is one reason behind Gartner's finding that "Data quality issues cost organizations an average of $12.9 million annually."

In BI-as-code, the same dashboard is a text file under version control:

# project.visivo.yml
name: Customer Analytics

sources:
  - name: warehouse
    type: duckdb
    database: analytics.duckdb

models:
  - name: customer_orders
    source: ${ref(warehouse)}
    sql: SELECT customer_id, order_date, order_value FROM customer_orders
    metrics:
      - name: total_revenue
        expression: "SUM(order_value)"
      - name: active_customers
        expression: "COUNT(DISTINCT customer_id)"
    dimensions:
      - name: order_month
        expression: "DATE_TRUNC('month', order_date)"

insights:
  - name: revenue_kpi
    props:
      type: indicator
      value: ?{ ${ref(customer_orders).total_revenue} }[0]
  - name: customers_kpi
    props:
      type: indicator
      value: ?{ ${ref(customer_orders).active_customers} }[0]
  - name: revenue_by_month
    props:
      type: bar
      x: ?{ ${ref(customer_orders).order_month} }
      y: ?{ ${ref(customer_orders).total_revenue} }

charts:
  - name: revenue_kpi_chart
    insights:
      - ${ref(revenue_kpi)}
  - name: customers_kpi_chart
    insights:
      - ${ref(customers_kpi)}
  - name: revenue_trend
    insights:
      - ${ref(revenue_by_month)}

dashboards:
  - name: Customer Overview
    rows:
      - height: small
        items:
          - chart: ${ref(revenue_kpi_chart)}
          - chart: ${ref(customers_kpi_chart)}
      - height: medium
        items:
          - chart: ${ref(revenue_trend)}

Every change to this file is explicit, reviewable, and reversible. That is the basis for developer-first BI workflows and visualizations as code.

Scaling analytics through automation

Code scales because it can be reused and automated. Forrester research found that between 60% and 73% of enterprise data goes unused for analytics, and manual bottlenecks are a large part of why. Work that once had to be repeated for each dashboard is defined once.

Component reuse: Define metrics, dimensions, and inputs once in the semantic layer and reference them from any Insight. A chart defined once can appear on any number of dashboards through ${ref()}:

# Defined once, in the semantic layer
models:
  - name: orders
    source: ${ref(warehouse)}
    sql: SELECT user_id, region, order_date, order_value FROM orders
    metrics:
      - name: base_revenue
        expression: "SUM(order_value)"
      - name: active_users
        expression: "COUNT(DISTINCT user_id)"
    dimensions:
      - name: order_month
        expression: "DATE_TRUNC('month', order_date)"

inputs:
  - name: region
    type: single-select
    options: ?{ SELECT DISTINCT region FROM ${ref(orders)} }

# Reused by any Insight, on any dashboard
insights:
  - name: regional_revenue
    props:
      type: bar
      x: ?{ ${ref(orders).order_month} }
      y: ?{ ${ref(orders).base_revenue} }
    interactions:
      - filter: ?{ ${ref(orders).region} = '${ref(region).value}' }

Fewer copies to maintain: A Visivo project is plain YAML, so any script can write it, but you rarely need one. A single dashboard with an input replaces a copy per department, and includes: splits a large project into one file per team:

# project.visivo.yml
name: Company Analytics

includes:
  - path: dashboards/sales.yml
  - path: dashboards/marketing.yml
  - path: dashboards/operations.yml
  - path: dashboards/finance.yml

Parallel execution: Visivo builds a DAG from your project and runs independent model and Insight queries in parallel. You control how many run at once and which part of the DAG to build:

# Run up to 8 queries at a time
visivo run --threads 8

# Rebuild one dashboard and everything upstream of it
visivo run --dag-filter '+Customer Overview'

Integrating BI-as-code into data systems

BI-as-code works best as one more step in the data pipeline, downstream of your transformations and deployed by the same CI. That is the modern data stack alignment argument in practice.

Version control: Keep analytics definitions in the same Git repository as your dbt™ transformations:

analytics-repo/
├── project.visivo.yml
├── dbt/
│   ├── models/
│   └── tests/
├── dashboards/
│   ├── executive/
│   ├── operational/
│   └── analytical/
├── metrics/
│   └── definitions.yml
└── .github/
    └── workflows/
        └── deploy.yml

Automated testing: Test analytics artifacts before a dashboard deploys:

# Tests assert on the values each Insight computes
tests:
  - name: revenue is positive
    assertions:
      - ">{ sum( ${ ref(regional_revenue).props.y } ) > 0 }"
  - name: first month has revenue
    assertions:
      - ">{ ${ ref(regional_revenue).props.y[0] } > 0 }"

visivo test runs these assertions, so CI can stop a bad metric before it ships. Data freshness belongs upstream, for example in dbt™ source freshness checks.

Continuous deployment: Compile, test, run, and deploy on every push to main. We cover the setup in CI/CD for analytics:

# .github/workflows/deploy.yml
name: Deploy Analytics

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: pip install visivo
      - run: visivo compile
      - run: visivo test
      - run: visivo run
      - run: visivo deploy -s staging
        env:
          VISIVO_TOKEN: $\{{ secrets.VISIVO_TOKEN }}
      - run: visivo deploy -s production
        env:
          VISIVO_TOKEN: $\{{ secrets.VISIVO_TOKEN }}

Workflows that come with code

Once dashboards are text in Git, the team inherits every workflow Git already supports.

Parallel development: Two people work on two dashboards at the same time, on separate branches:

# Developer 1: Working on sales dashboards
git checkout -b feature/sales-dashboard
# Makes changes to sales dashboards
git commit -m "Add quarterly sales trends"

# Developer 2: Working on marketing dashboards
git checkout -b feature/marketing-dashboard
# Makes changes to marketing dashboards
git commit -m "Add campaign performance metrics"

# Both changes merge without conflicts
git merge feature/sales-dashboard
git merge feature/marketing-dashboard

Fast rollbacks: Recovery is a revert and a redeploy:

# Problem detected in production: revenue calculation shows an anomaly

# Revert the change that caused it
git revert <bad-commit-sha>
git push

# Rebuild and redeploy the last known good version
visivo run
visivo deploy -s production

Self-service analytics: A business user who wants a new metric opens a pull request. The review happens in the open, and the change is tracked like any other:

# Business user submits PR for new metric
models:
  - name: customer_surveys
    source: ${ref(warehouse)}
    sql: |
      SELECT region, satisfaction_score, survey_date
      FROM customer_surveys
      WHERE survey_date >= CURRENT_DATE - 30
    metrics:
      - name: customer_satisfaction_score
        expression: "AVG(satisfaction_score)"
        description: "Average CSAT score over the last 30 days"

Analytics alerting: Notify the team when a test fails:

destinations:
  - name: data-team-slack
    type: slack
    webhook_url: ${env.SLACK_WEBHOOK}

alerts:
  - name: test-failure
    if: ">{ anyTestFailed() }"
    destinations:
      - ${ref(data-team-slack)}

Teams that adopt BI-as-code report:

  • Significant reduction in dashboard development time
  • Fewer production incidents
  • Faster onboarding of new team members
  • Improvement in metric consistency

These gains are consistent with MIT's research showing "Companies using data-driven strategies have 5-6% higher productivity" when their analytics infrastructure scales with them.

As data volumes grow, the ability to scale analytics in code stops being optional. The YAML in this post is Visivo's project format: /get-started takes you from install to a first dashboard, and the examples gallery shows full projects built the same way.

Related reading: YAML vs GUI BI configuration, dashboard version control collaboration, and faster feedback cycles.

Install command copied