top of page

Something You Should Know About #DATES# in Tableau

This week, my #MakeoverMonday submission was aimed at achieving two goals. The first was to recreate the awesome heat maps I saw posted on Twitter and Tableau Public. The second was to incorporate an image of 10 Downing Street, headquarters of the Government of the United Kingdom.

The data was quite simple; a time, a date, and the kwh of electricity used.

The complimentary data I will be only 4 dates; 3/20/17, 6/21/17, 9/22/2017, and 12/21/2017.

Those are the rounded dates noting the March Equinox, June Solstice, Fall Equinox, and December solstice for London in 2017.

My inspiration for adding in the solar calendar markers was based on this heat map posted by Kimly Scott (@scottkimly). The color scheme suggested infrared camera images, like those used to simulate the vision of a mosquito on a nature documentary. The Rows are split into one-hour windows for a full 24-hour time period and the columns split by Month and day of week.!/vizhome/MakeoverMondayWeek42019-EnergyUsage10DowningSt/EnergyUsage

I live in New England, and just like in “Old” England, we experience a temperate climate with temperature swings from around 20-25 degrees C in the summer and 0-5 degrees C in the winter. The cost of that rhythm in electricity consumption immediately struck me when looking at this viz. The summer months in the center of the layout are bright during the hottest past of the day. The spring and fall are darker as temperatures remain moderate and the path of the sun changes.

The regularly spaced vertical bands denoting the weekends humanizes the view by depicting the traditional 40-hour workweek. There are few cases of behavioral analytics that can be as clearly displayed through data visualization as the 9 to 5 grind.

This visualization is beautiful but sorting the months this way splits up the middle of winter, which is the peak energy consumption period. My goal was to take this same design concept but divide the columns into seasons instead of months. These four heat maps will be my white pained windows placed in a row on top of a background image.

What I ended up relearning was how to create custom date groups to show “seasons” instead of the fixed dimensions within the Gregorian calendar. Also, I tried to apply some lessons I have learned about proper use of color in data visualization.

Here is an image of the final viz.

First, here is how to create the date calculation needed to split up this year into seasonal segments.

if ([Date] >= #3/20/2017# and [Date] < #6/21/2017#) then "Spring"

ELSEIF ([Date] >= #6/21/2017# and [Date] < #9/23/2017#) then "Summer"

ELSEIF ([Date] >= #9/23/2017# and [Date] <= #12/21/2017#) then "Fall"

ELSE "Winter"


The dates being used as reference points need to be surrounded by #’s. We could have added in the full dates and times, but the day cuts give us the most even view. This method is great in business use cases for tracking the effectiveness of process changes, marketing promotions, and any other before/after comparisons you want to analyze.

Next, I created a highlight table with all the fine formatting I wanted on the view and tool tips, then copied 3 times and filtered each to a specific season, also using the season as the sheet names and titles.

For the colors, I needed to make sure the bright and dark tones matched the background image. The first picture I wanted to use (to the left) was taken during the day. I put together a quick dashboard to see if I was on the right track. The image is very clear, but the difference between the hot/cold spots of the heat map is just not dramatic enough to catch the viewers eye.

Then I had a light bulb of an idea; literally! I searched for an image with that lone lantern burning. The brightness of the light against the dark brick was perfect. The only problem was that Tableau did not have a color scheme that matched.

Creating custom sequential color palettes in Tableau.

For this viz, I will be grabbing the color codes right from the image. I opened up the text box I was using for the title, then selected “pick screen color” and jotted down the three colors I was using. Once you have two or three color codes, search your machine for the “Preferences.tps” file.

Open it with a notepad and edit the contents like so (using dummy color codes);



<color-palette name= ”YOUR CUSTOM PALETTE NAME” type= “ordered-sequential”

<color> #000000</color>

<color> #000001</color>

<color> #000002</color>



Save the file, close and reopen your Tableau workbook, then your new custom color palette will show in the color option list. If there is a syntax error, Tableau will notify you to go back and check how you coded everything into the preferences file.

On the final layout, I matched the text color to the middle color on my custom palette, arranged the views to match the image as originally intended, added a few line charts to give some additional scale and trends of the relative consumption for each season, then capped it off with a "cheeky" caption by the Bobby in bottom right corner of the photo.

Questions, comments, recommendations for future blogs? Let us know!


bottom of page