Using Tableau for Live Dashboards on Event Data
Tags: sql, tableau, dashboard, tutorial
Published: 2019-08-08 00:17:30

---
title: Using Tableau for Live Dashboards on Event Data
published: true
tags: sql, tableau, dashboard, tutorial
canonical_url: https://rockset.com/blog/using-tableau-for-live-dashboards-on-event-data
---

*Authored by [Haneesh Reddy Poddutoori](https://www.linkedin.com/in/haneeshreddy/)*

Live dashboards can help organizations make sense of their event data and understand what's happening in their businesses in real time. Marketing managers constantly want to know how many signups there were in the last hour, day, or week. Product managers are always looking to understand which product features are working well and most heavily utilized. In many situations, it is important to be able to take immediate action based on real-time event data, as in the case of [limited-time sales in e-commerce](https://rockset.com/blog/fynd-e-commerce-portal-responds-to-consumer-behavior-in-real-time/) or [managing contact center service levels](https://rockset.com/blog/full-uses-rockset-with-dynamodb-for-live-dashboard/). With the realization of the value businesses can extract from real-time data, many organizations that have standardized on Tableau for BI are seeking to implement live Tableau dashboards on their event streams as well.

### **Getting Started**

In this blog, I will step through implementing a live dashboard on event data using Tableau. The events we will track will be recent changes to various Wikimedia projects, including Wikipedia.

![wikimedia-edits](https://images.ctfassets.net/1d31s1aajogl/1gT9zee7eYQsjCELUgL61K/19bc108e34bcc237f0747893f03ba535/wikimedia-edits.png)

For this project, we will need:

- [Tableau Desktop](https://www.tableau.com/products/desktop), with an active account
- An active [Rockset](https://rockset.com/) account
- [Rockset Java client library and JDBC driver](https://github.com/rockset/rockset-java-client)

### **Ingesting Data from Wikimedia Event Stream**

I will first create a collection, to which we will write the events originating from the [Wikimedia stream](https://wikitech.wikimedia.org/wiki/Event_Platform/EventStreams).

![rockset-create-collection](https://images.ctfassets.net/1d31s1aajogl/6hduKypkDu11xssYvaD4y6/f624cbbda2b3029413df13e1db9f2883/rockset-create-collection.png)

Once we have the collection set up in Rockset, I can run a script that subscribes to events from the Wikimedia stream and writes them to the `wiki-events` collection in Rockset.

{% gist https://gist.github.com/jklegar/cccc4e083332b598a6e047c99af46178
%}

While we are using Rockset's [Write API](https://docs.rockset.com/write-api/) to ingest the Wikimedia event stream in this case, Rockset can also sync data from other sources, like Amazon DynamoDB, Amazon Kinesis, and Apache Kakfa, to power live dashboards, if required.

Now that we are ingesting the event stream, the collection is growing steadily every second. [Describing](https://docs.rockset.com/commands/#describe) the collection shows us the shape of data. The result is quite long, so I will just show an abbreviated version below to give you a sense of what the JSON data looks like, along with some of the fields we will be exploring in Tableau. The data is somewhat complex, containing sparse fields and nested objects and arrays.

{% gist https://gist.github.com/jklegar/7289080bc5a1fe0d33de99076c2a1463
%}

### **Connecting a Tableau Dashboard to Real-Time Event Data**

Let us jump into building the dashboard. I'll first need to connect to Rockset, as a new data source, from my Tableau Desktop application. Follow the steps [here](https://docs.rockset.com/tableau/) to set this up.

We can create a first chart showing the number of changes made by bots vs. non-bots for every minute in the last one hour. I can use a [custom SQL query](https://onlinehelp.tableau.com/current/pro/desktop/en-us/customsql.htm) within Tableau to specify the query for this, which gives us the resulting chart.

{% gist https://gist.github.com/jklegar/7b9eb83d33396c9f2c634688523a03ee
%}

![tableau-live-dashboard-1](https://images.ctfassets.net/1d31s1aajogl/6VwjaSDHiKbEHUof657aWt/7d6117f12e67f23818203af115d7c3ba/tableau-live-dashboard-1.png)

That's about 1,400 events per minute, with [bots](https://blog.wikimedia.org/2017/08/30/wikipedia-bot-pocalypse/) responsible for the majority of them.

Wikimedia also tracks several types of [change events](https://www.mediawiki.org/wiki/Manual:Recentchanges_table#rc_type): edit, new, log, and categorize. We can get an up-to-date view of the various types of changes made, at 10-minute intervals, for the last hour.

{% gist https://gist.github.com/jklegar/5f6e2033be74aa41ccdb4758c409244f
%}

![tableau-live-dashboard-2](https://images.ctfassets.net/1d31s1aajogl/4YO3IdjVn8ztgXbOC39aOV/c28a81b325afd0b6a1b03d0fd2f35a9a/tableau-live-dashboard-2.png)

Finally, I plotted a chart to visualize the magnitude of the edits made within the last hour, whether they were small-, medium-, or large-scale edits.

{% gist https://gist.github.com/jklegar/afca595b1822414fb87ce36960031b8f
%}

![tableau-live-dashboard-3](https://images.ctfassets.net/1d31s1aajogl/362bMWmxYSc3IjQqKSlmXs/3eced220ac306f2561f32c3d8a62e243/tableau-live-dashboard-3.png)

### **Recap**

In a few steps, we ingested a stream of complex JSON event data, connected Tableau to the data in Rockset, and added some charts to our live dashboard. While it may normally take tens of minutes, if not longer, to process raw event data for use with a dashboarding tool, using Tableau on real-time data in Rockset allows users to perform live analysis on their data within seconds of the events occurring.

If you wish to adapt what we've done here to your use case, the source code for this exercise is available [here](https://github.com/rockset/recipes/tree/master/rockset-tableau-wiki).