Create Looker Sankey Diagram

  • 2 September 2019
  • 9 replies

Hi there,

I’d like to create a Sankey Diagram to show flow. Data will be like page views. Users will be directed to 1st page, and then to other pages.


timestamp, user_id, page_name

How should I properly create Sankey diagram? I found very limited sources online.

Need to know:

1). Is it necessary to prepare data in certain form? If yes, what form does it have to be?

2). How to prepare in LookML


9 replies

Userlevel 6
Badge +1

You can use the following:

Unfortunately I don’t think there is a lot of active development with this script. It would be awesome if somebody created a new version that works with pivots etc.

Hi Dawid,

Thanks for the resources. I have checked these two articles already, however, i’m still not sure how to create diagram.

I feel the same that there is not a lot of development. So few articles talking about this.

Userlevel 6
Badge +1

I managed to get a diagram working but don’t think we will actively use it because of lack of working with pivots, tooltips, highlighting whole path across multiple nodes etc.

How far did you get?


Here is a quick example of a Sankey diagram setup.

In this example, we are looking at where people who leave San Francisco move to:

To get a Sankey diagram working, you need at least two dimensions and only one measure. For the migration example above, while my explore has four dimensions selected, I am hiding two of them from the visualization:

You can add more dimensions, based on what makes sense about the relationships you are trying to define. In this case, I added migration data from New York County, NY to see the common destinations people leaving New York and San Francisco go to. In this case, I unhid the “origin state” dimension so that now there are three dimensions (origin county, origin state, and destination county)

One thing to be aware of is that the Sankey reflects the order of dimensions as arranged in your “Data” tab. So if you want to see the flow from origin county -> state to destination state-> county, you will need to arrange your fields accordingly:

If you would like more options for configuring Sankey diagrams and are comfortable with javascript and Typescript, we do make the visualizations available in the public repo that @Dawid_Nawrot linked above, so you can fork it and modify them as you see fit.

Yeah. I got the graph. But couldn’t find much options to edit the data. Please help here. If you are using multiple stages, then multiple columns will appear and hence it is becoming difficult to identify which stage belongs to what. Can we just have column header? Requesting your support in this problem

Userlevel 7
Badge +1

Mihir, could you maybe provide a diagram of what you’d like to see?

Our Sankey custom viz example requires a pretty specific configuration, which Shingi laid out above— If you’re a JS whiz, you could modify it to fit your needs, but I don’t think you’ll get much flexibility out of it as is.

Hi Izzy,

Similar to that added image can we just add the stage name above all the columns we usually have in the Sakey Chart. Maybe for the simplicity purpose, we can take column names from the database as stage names. Please let us know if this is feasible.

Userlevel 7
Badge +1

Ah, I get it. That functionality doesn’t exist now, but wouldn’t be too hard to add to the custom viz if you do know some javascript. If anyone else feels like giving it a shot, here is the link to the visualization on github: Would love to see some work done on it!

Hi @Ashton_Du,

I hope you are doing well, check my Sankey diagram created in Excel to visualize user behavior.

I used ChartExpo™️ , It is both an Excel and Google Sheets plugin for data visualization.
There is no requirement of coding skills.

Try it for Free:

ChartExpo™ for Excel & Office 365

ChartExpo for Google Sheets



Sharing a video to watch how easy to create Sankey diagram in Google Sheets and Excel.


All the Best!