Skip to content

Repository files navigation

Transpose Matrix Pro

A modern, minimalist Power BI Custom Visual that reimagines the native Matrix with a one-click transpose (swap rows ↔ columns), independent blank/zero row and column filtering, and a clean Microsoft 365-style design.


Features

Feature Details
Transpose Swap rows ↔ columns in memory with a single click — no DAX, no re-query
Hide Blank Hides rows/columns where every cell is null / undefined
Hide Zero Hides rows/columns where every cell is exactly 0 (numeric)
Hide Blank-or-Zero Combines both rules
Grand Total — authoritative Always shows the value Power BI delivers; never re-sums visible rows
Hierarchies & subtotals Full DataViewMatrix tree rendering with indent levels
Multiple measures Renders all value fields side by side per column group
Field Parameters Works out of the box — resolved from the DataViewMatrix on each update, never by field name or GUID
Selection API Row click → cross-filter / cross-highlight other visuals
Context menu Right-click → native Power BI context menu
Formatting Model Fully compatible with Power BI format pane (toggle switches, numeric inputs)
Responsive Toolbar collapses to icon-only at < 360 px width
Accessible role="grid", role="rowheader", aria-label on rows

Download & Import

  1. Go to the Releases page.
  2. Download TransposeMatrixPro.pbiviz.
  3. In Power BI Desktop → InsertMore visualsFrom file → select the .pbiviz.

Data Roles

Role Type Description
Rows Grouping Fields that become row headers
Columns Grouping Fields that become column headers
Values Measure One or more measures

Format Pane Options

General

  • Transposed — persists the transpose state between report sessions.

Row Visibility

  • Hide Blank Rows — rows where all cells are blank.
  • Hide Zero Rows — rows where all cells are exactly 0.
  • Hide Blank-or-Zero Rows — rows where all cells are blank or 0.

Column Visibility

  • Same three options, applied to columns.

Style

  • Font Size — default 13 px.
  • Show Grid Lines — toggle table borders.

Blank vs Zero — exact semantics

BLANK  = rawValue === null || rawValue === undefined
ZERO   = typeof rawValue === "number" && rawValue === 0

A row/column is hidden only when all of its cells (across every measure and every column/row on the other axis) satisfy the active rule. A single cell that doesn't satisfy the rule keeps the entire row/column visible.


Architecture

DataView
  └── MatrixAdapter          — sole module that touches DataViewMatrix
        └── NormalizedMatrix — internal model, zero Power BI types
              ├── VisibilityEngine  — blank/zero filtering
              ├── TransposeEngine   — in-memory rows ↔ columns swap
              └── RenderModel
                    └── MatrixRenderer  — DOM construction (no innerHTML)

All business logic lives in modules with no dependency on powerbi-visuals-api, making them fully unit-testable with plain Node.js.


Build from Source

Requirements: Node.js 18–20 LTS, npm.

git clone https://github.com/ludodelot/transpose-matrix-pro.git
cd transpose-matrix-pro
npm install
npm install -g powerbi-visuals-tools   # if not already installed
npm test          # 29 logic tests, no Power BI runtime needed
npm run build     # produces dist/*.pbiviz

Logic Tests

All blank/zero/visibility/transpose/totals rules are covered by unit tests that run with plain tsx — no Power BI runtime, no mocking:

TEST A — HIDE_ZERO / HIDE_BLANK / HIDE_BLANK_OR_ZERO across 3 products × 2 years
TEST B — Two measures: Sales=0, Margin=BLANK → correct per-mode behavior
TEST C — Sales=0, Margin=10 → always visible (non-zero measure protects the row)
TEST D — Transpose engine: rows ↔ columns swap, cell values preserved
TEST E — Column hiding: all-zero column hidden, non-zero column kept
TEST J — Grand Total: value from Power BI unchanged when rows are hidden

Design Tokens

Token Value Use
Accent #2563EB Button, borders
Accent hover #1D4ED8 Button hover
Soft #EFF6FF Row hover, total bg
Active #DBEAFE Selected state
Text #242424 Primary text
Text secondary #616161 Secondary text
Border #E5E7EB Table grid lines
Header bg #FAFAFA Sticky headers

License

MIT

About

Power BI Custom Visual — modern matrix with one-click transpose, blank/zero filtering, hierarchies, and Microsoft 365-style design

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages