One of the best ways to learn Tableau is by making your initial projects personal. Finding a topic you’re interested in can accelerate your trajectory much more than fiddling with Superstore data. While Superstore data is certainly appreciated, pairing a topic of interest with a popular existing visualization as your template can make things even more enjoyable, and that is what this blog post is all about.
I’m certain that if you are reading this blog, you might have already seen this, but if not here is an interesting viz created by Leonard Kiefer that shows how United States home values have changed relative to a moving anchor date.
— Leonard Kiefer (@lenkiefer) May 24, 2017
Now this is a really cool visualization that gives someone a sense for how the overall housing markets were changing, but what if I want to see how MY HOUSE has changed since I purchased? With that question in mind, I set off to do two things; recreate the original visualization in Tableau, and make it personal.
Using Tableau’s data prep tools
For starters, the data you need to recreate this viz starts here: http://www.freddiemac.com/research/indices/house-price-index.html
Finding data that is easy to download is every Tableau Public author’s dream, but sometimes there are some additional preparations to be made in order for it to be usable in Tableau Desktop. The data from the link above comes out looking like this in Excel…
Immediately we are looking at a few problems:
- Header city
- Pivoted data.. each state is a column, which is just not practical for Tableau
- Dates aren’t dates
- Footers (not pictured)
In a previous life we would have to do some Excel surgery ourselves to get this in a usable format, but Tableau has been kind enough to provide us built in tools that will fix all of our data prep needs (in this situation).
When you first connect to the Excel file and bring into Tableau, this is what you will see. Tableau is reading the header as rows (which they are), and doing the same with the footer (not pictured).
This looks like a headache, but in the upper left corner of your screen under the data connection, there is a magic button labeled “Use Data Interpreter”… go ahead and click it.
Now we can see that Tableau interpreted the header as junk, and cleaned it up for us, but we still have the problem of pivoted data, weird dates, and footer issues.
To fix our pivoted data we can simply select all of the columns that we want to turn into rows, right click, and select pivot.
Performing that action will eliminate all of the state columns and create two new columns; Pivot Field Names (Column Headers) and Pivot Field Values (Column Values). Simply rename them to something that makes sense for your project.
Another bit of magic that Tableau has recently integrated into their product is date interpretation. The Excel file shows dates as strings in this format YYYY”M”MM, and in a previous life we would have to write some calculations to merge those pieces together and create a true date field. Now we can simply change the data type from String to Date, and Tableau will do the heavy lifting for us.
Our last problem is the footer area of the Excel sheet. In this scenario, I know that all of my states should have a month attached, so we can simply filter out NULL months at the data source level to resolve the footer data.
Extract the data for publishing to Public and we are ready to start building.
Here is an image of the finished product, go ahead and click it if you don’t want to read about the design.
This viz takes a lot of cues from the original, but has a much needed story added to it, how does the housing market relate back to you? Three pieces of information are needed in order to make this viz personal: purchase date, state you purchased in, and approximate price you paid.
By providing a purchase date, we can set the anchor for price comparison. The data provided compared everything to December 2000, every value for that year/month is normalized to 100. Your purchase date sets the new bar for comparison, and creates a new price index for every single month in every single state. Basically… I don’t care how my home’s price changed since 2000… I was in 8th grade for hell sake. I want to know how things have changed since the date that is relative to ME.
Since we are making this viz personal, I want to highlight your state and push everything else to the background for context. The state parameter allows me to create a boolean (your state/not your state), and control size/color based on the binary value. This color and size gets reinforced from top to bottom, as the summary text sets the context for the line chart by immediately showing you that turquoise relates to the state you selected.
What I really want to know in the end is this: Is my home worth more or less than when I bought it? By knowing your purchase price, I can look at the relative price change since your purchase date and do the math to see how that price change effected your purchase.
To summarize, I would have never thought to create this viz without stumbling upon the original visualization. In the process, I had the opportunity to use some of the newer data prep tools, that I otherwise might not have used. I also had a chance to answer a personal question, all the while adding to my Tableau skills and Public portfolio.
Thanks for reading!