A dashboard that looks different based on the time of day? A beautiful starry sky at night, and a clear mountain peak during the day. How cool would it be if your dashboard adjusted throughout the day. It can! I have developed a method by which your dashboard changes with time. After a tweet that did well, In this blog I explain step by step how I did it.
Dynamic dashboard through time
First, I'll briefly take you through how I came up with this idea. I am a fan of nice looking and functional dashboards. So I started cobbling together a background with some background images of mountains. I was pretty happy with the results and decided to create a dashboard on Tableau Public so I could share my work. As I was working on the backgrounds, I noticed that I had unwittingly created a background for different times of day. One of night, with a beautiful starry sky, one for daytime, and a sunrise and sunset.
Then I came up with the idea. What if I let the background change with the time of the user at that moment. How cool is it when you look at a dashboard at night, you can enjoy the starry sky. I also thought it would be fun to make a greeting that changes through the day. So good morning when you log in in the morning, and good afternoon in the afternoon. Using a Calculated Field and Tableau's Dynamic Zone Visibility, I created this.
Here I explain step by step how I did it. My dashboard changes background 4 times a day, so for morning, afternoon, evening and night. Of course, you can do much more with this technique. You can change not only the background but also the content of the dashboard. So that users see different visualizations in the morning than in the evening. You can also have a dashboard change background or colors with the season, month, minute, whatever. There are lots of possibilities. Keep these in your mind as you go through my steps. Have fun!
1. Determine what you want to change and when.
A logical first step. First, decide what you want changed when. Do you want something changed per month? Or per day? And perhaps more importantly, what do you want changed? Certain sheets? Or backgrounds of the dashboard? I wanted my dashboard to change backgrounds 4x a day, at the transitions from morning > day > evening > night.
2. Create Calculated Field
Now that you know what times your dashboard should change, create Calculated Fields in Tableau. This calculated field tests whether the current time when the user opens the dashboard (NOW ( ) ) matches the date or time of a change you want to make. For example, with the following calculation, I test whether it is in the night:
The calculation tests whether the current hour is between 00:00 (12AM) and 06:00 (6AM). If it is, it is midnight and the calculation returns TRUE. If it is outside these hours, it is not night and the calculation returns FALSE. Thus we have a Boolean calculation to test whether it is night. I then make the same kind of calculation to test whether it is morning, noon or evening.
3. Set Dynamic Zone Visibility.
Recently, Dynamic Zone Visibility was added to Tableau. Briefly, what you can do with this is show or hide items in your dashboard based on a Boolean field. And let's just say we created a Boolean calculation. So we set that when the Boolean field is TRUE, an item is shown. If the calculation for Night is TRUE, we get to see the background for the night.
Make sure you add all the items you want to show in your dashboard. Place them in the correct position. I put my components in floating so I can put them on top of each other. I add 4 backgrounds on top of each other. Then, one by one, I assign the appropriate calculated field to the Dynamic Zone Visibility. At your dashboard, go to the Layout pane. In the Item Hierarchy, select the item you want to appear. Check "Control Visibility using value. And choose the calculation on which the item should appear. I choose my night background, and the calculation 'Night'. Repeat these steps for the other elements in your dashboard that you want to show or hide based on time.
And there you have it, a dashboard that changes over time. Let me know on Twitter what great things you make with this technique. Have fun!
Also follow me on Twitter for more content @JorisNLD