Power BI How-To

How to make a sankey diagram in Power BI

Build a sankey diagram in Power BI: field wells, a worked example, when the native visual is enough, and how to generate the .pbiviz without code.

By · Founder & Reliability Engineer · Updated

A Sankey diagram answers one question a funnel can't: where did each group go? A funnel tells you 40% of trial users churned; a Sankey shows that most of the churn came from one acquisition channel and skipped onboarding step two. In Power BI that makes it the right chart for customer journeys, budget cascades and anything where a quantity splits and recombines across stages.

The practical obstacle is the data, not the drawing. Sankey data is a list of edges (source, target, value), while most Power BI models are wide tables with one row per customer. This guide covers the reshape in Power Query, the three field wells the generated visual exposes, and the checks that catch the two classic mistakes: swapped source/target columns and accidental cycles.

Step-by-step

  1. 1

    Shape the data for the sankey diagram

    Three columns: source (text), target (text), value (numeric). Each row is one flow segment. For multi-level Sankeys, chain source→target rows so the targets of one level appear as sources in the next. In the finished visual those columns land in the Source, Target, Value wells, so name them that way from the start.

  2. 2

    Load a small sample into Power BI Desktop

    Import the six edge rows from the worked example into Power BI Desktop as one table. Keep both levels, so you can check that Onboarded is drawn once, with ribbons entering from the channels and leaving towards Converted and Churned.

  3. 3

    Describe the sankey diagram and generate the .pbiviz

    On VizForge, describe the chart in plain English and say what matters for this one: how many levels, and whether a node can appear at more than one level (Churned above appears twice); node ordering: alphabetical, by total flow, or in the order of your stage list; link colour rule: by source node, by target node, or a fixed colour for one outcome (red for churn). The pipeline writes the TypeScript, type-checks it and packages a .pbiviz.

  4. 4

    Import the .pbiviz into Power BI Desktop

    In the Visualizations pane, open the three-dot menu, choose Import a visual from a file and select the .pbiviz. The visual appears in the gallery; add it to the page like any built-in chart.

  5. 5

    Bind the field wells

    Source: Text column: the node a flow leaves (Channel, Stage 1). Target: Text column: the node a flow enters (Onboarded, Churned). Value: Numeric measure: the width of the ribbon (customers, dollars, kWh).

  6. 6

    Check the first render, then format

    All nodes stacked in one column means Source and Target hold the same values; check the reshape. A node drawn twice with slightly different names ('Churned' and 'Churned ') is a trim problem in Power Query. Then open the formatting pane and set node width and the vertical gap between nodes (the two numbers that decide whether 12 nodes fit).

Field wells the generated sankey diagram exposes

After import, these are the data roles you drop fields into. The names come from the visual’s capabilities.json, which you can rename before packaging if your team uses different terms.

WellTakesNote
SourceText column: the node a flow leaves (Channel, Stage 1).Node labels are built from the distinct values of Source and Target together, so spell a stage identically in both.
TargetText column: the node a flow enters (Onboarded, Churned).For a multi-level Sankey, the Target of one level must appear as the Source of the next.
ValueNumeric measure: the width of the ribbon (customers, dollars, kWh).Use a measure, not a column, so filters on the page shrink the ribbons correctly.

Worked example

Trial sign-ups from two channels moving to Converted or Churned.

SourceTargetValue
Paid searchOnboarded420
Paid searchChurned180
OrganicOnboarded610
OrganicChurned90
OnboardedConverted700
OnboardedChurned330

What the chart draws: Three columns of nodes: channels on the left, Onboarded and Churned in the middle, Converted and Churned on the right. The Paid search → Churned ribbon is twice as thick as Organic → Churned even though Organic brought more sign-ups, which is the finding the chart exists to surface.

Live preview

Live preview · sample dataDownload sample data (CSV) ↓
ChannelOutcomeSearch600Referral360Social440Converted620Nurturing420Churned360
Acquisition channels flowing to outcomes — a Sankey traces how volume splits and where each lead lands. Rendered live from sample data — your generated visual uses your own model.

The AI alternative: Describe your sankey diagram in plain English and VizForge generates the .pbiviz, source included. 5 free credits on signup, no card required.

Generate a sankey diagram on VizForge →

Without code: what to put in the prompt

The generator turns a description into the TypeScript, so the description is where the decisions live. For a sankey diagram, say:

  • How many levels, and whether a node can appear at more than one level (Churned above appears twice).
  • Node ordering: alphabetical, by total flow, or in the order of your stage list.
  • Link colour rule: by source node, by target node, or a fixed colour for one outcome (red for churn).
  • Label content: node name only, name plus total, or name plus percentage of the first column.
  • What should happen on click: cross-filter the page by that node, or by that single link.

Example VizForge prompt

Sankey diagram showing customer flow from 5 acquisition channels through 3 onboarding steps to either Converted or Churned. Left-aligned node labels with percentages. Use a blue-to-green gradient for converted paths and red for churn.

Customise it: formatting options worth exposing

Anything you name as adjustable becomes a card in Power BI’s formatting pane, which a report theme can then set for every copy of the visual. For a sankey diagram the options that earn their place are:

  • Node width and the vertical gap between nodes (the two numbers that decide whether 12 nodes fit).
  • Link opacity, and a toggle for gradient links (source colour fading into target colour).
  • Label position (inside the column or outside the outer nodes) and font size.
  • Minimum link value to draw, so a long tail of tiny flows becomes one 'Other' ribbon.
  • Node colour per category through the formatting pane, so a report theme can override it.

For changes the pane doesn’t cover, edit settings.ts and visual.ts in the source that ships with the download and repackage; or refine on VizForge and get a v2 that keeps everything you didn’t mention.

When native Power BI is enough (as of November 2026)

There is no native Sankey in Power BI. The closest built-in options are the Decomposition tree, which shows one path at a time rather than all flows at once, and a stacked bar per stage, which loses the connection between stages. If you only need to show that a total splits into parts once, a stacked bar or a 100% stacked column is enough; the moment a reader asks 'where did that group go next', you need a Sankey.

Limits of Marketplace sankey diagram visuals

Marketplace Sankeys fix how cycles and self-loops are handled, how many levels are supported and whether a node can repeat across levels; if your journey data has any of those, you are limited to the vendor's choice. Node ordering is usually automatic, so you can't force a stage sequence that matches your pipeline. Several are free to use but charge for formatting options such as link gradients or per-node colours, and none let you add a field well (for example a second measure to drive link colour).

The general trade-offs (per-user licensing, closed source, no new field wells) are the same for every chart type; see VizForge vs Microsoft Marketplace visuals for the full comparison.

Download, install and first render

The download is a standard .pbiviz plus the TypeScript source. Import it in Power BI Desktop (Visualizations pane → three dots → Import a visual from a file), add it to the page and bind the wells above. Then check the sankey diagram against this list before you connect the full dataset:

  • All nodes stacked in one column means Source and Target hold the same values; check the reshape.
  • A node drawn twice with slightly different names ('Churned' and 'Churned ') is a trim problem in Power Query.
  • Ribbons that don't add up to the node height mean the Value well holds a column rather than a measure.
  • Click one node and confirm the rest of the page filters; that is the cross-filter wiring working.

When to use a sankey diagram

  • Customer journey: acquisition channel → onboarding step → conversion or churn
  • Budget cascade: total revenue → segment → cost bucket → net margin
  • Energy / material flow audits (sources → intermediates → outputs)
  • Multi-stage qualification funnels where candidates flow between named states
  • Employee headcount movement (joins, exits, transfers between departments)

Frequently asked questions

Will the visual work in Power BI Service, Premium and embedded reports?

Yes. A .pbiviz is a standard Power BI custom visual and renders the same in Desktop, the Service, Premium and Premium per User capacities, and embedded scenarios. Tenant admins can restrict custom visuals to certified or organisational ones; if yours does, publish the .pbiviz as an organisational visual rather than importing it per report.

What if I need to change the visual later?

Two paths. Refine on VizForge with an instruction such as "add a target line" and get a v2 .pbiviz that keeps everything you didn't mention; or open the TypeScript source that ships with every download in VS Code, edit it and repackage with pbiviz package.

Does the Sankey work in Power BI Service or only Desktop?

Both. Generate the .pbiviz, import it into Power BI Desktop, build your report, publish to Service — the visual renders in the browser exactly as it does locally.

Can a Sankey cross-filter other visuals on the page?

Yes. Every VizForge-generated Sankey includes SelectionManager integration, so clicking a node or link acts as a slicer on the rest of the page.

How many levels can the Sankey handle?

Arbitrary depth. The AI-generated visual infers levels from your source/target columns — 2 levels, 5 levels, 12 levels — and lays them out automatically.

My flows have feedback loops. Will the Sankey handle that?

Standard Sankeys don't support cycles. For feedback loops (e.g. customer returns), use a chord diagram instead — VizForge generates those too.

Put your sankey diagram on a designed page

Free Design Studio page layouts. Download the background, theme and PBIP project, then import the visual into the slot.

Design the page around it, free

A custom visual looks best on a designed page. The free VizForge Design Studio lays out a branded report page at Power BI’s pixel size and exports the background image, a theme JSON and a PBIP project. No signup.

Open the free Design Studio →

Guides for related charts

VizForge — AI-generated Power BI custom visuals.

Make the report.
Then make it yours.

The Design Studio, templates and tools are free with no account (exports carry a small VizForge mark until you sign in). Sign up when you want AI: 5 credits on us, no card.

Generated visuals are type-checked and built before you download them; one that fails the quality SLA refunds its credits. See all features or pricing.