Building a Custom Power BI Visual from scratch (KPI Card)

Steve de Peijper
Custom Visuals
Published in
6 min readJun 25, 2022

--

In this article we will build a custom Power BI visual from scratch, we will build a KPI card with selections (interactivity in the dashboard), drill-through functionality, formatting options and highlighting.

The code changes are kept to a minimum, so we hardly use typing or describe interfaces. This allows us to focus on the core mechanisms that we need to introduce in the code.

Each steps links to a GitHub commit so you can easily reproduce what happened.

Enjoy!

Create the Solution

First, we create a new visual using PowerShell and open Visual Studio:

pbiviz new KPICard_Tutorial
cd kPICardTutorial
start devenv .

See commit for the newly created files.

Create the Power BI File

We create the Power BI File with some Sample Data.

We publish the Power BI file to the cloud and start the server (using PowerShell).

pbiviz start

We add the custom visual (‘</>’) and press the reload button (triangle).

Start Developing

--

--

Steve de Peijper
Custom Visuals

Background in BI & Advanced Analytics enjoys writing code for various applications like analyzing sporting activities, home automation, and office productivity.