Date Archives September 2018

WEEK 39: VERTICAL LABEL AND 3 MARKS

Hello Again! This week I am back with a fairly simple challenge, but one that has a few (I believe) useful tricks that could help spice up your next viz. The tricks used here are geared toward design, but have additional benefits.

Requirements:

  • Dashboard size: 1000 x 800
  • Create a Parameters for metrics Sales|Profit|Quantity
  • Create an Area Chart with a Line and Circle Marks for the Selected Metric over Month/Year of Order Date
  • The Metric Selected must be Vertically displayed on the Y Axis, this is dynamic based on the Metric Parameter, and is a single calculated field. 
    • DON’T HARD CODE THE LABELS! Think through what features Tableau offers that allow you to dynamically change/format strings
  • Pay attention to White Space and weighting!

Data from this week comes from the Saved Data Source in Tableau 2018 (Sample – Superstore), download here if needed.

After you finish your workout, share on Twitter using the hashtag #WorkoutWednesday and tag @AnnUJackson, @LukeStanke, and @RodyZakovich.  (Tag @VizWizBI if you have space, he would love to see your work too!)

Also, don’t forget to track your progress using this Workout Wednesday form.

Week 38: Discovery Dashboard

One of my absolute favorite things about Tableau is that not only is it a fantastic data display tool, but it is amazing at data exploration and discovery.  While you’re in the flow of analysis there are tons of built in features that provide you feedback, awareness, and insight into your data.  Everything from displaying the number of marks on a sheet in the lower left corner (along with the sum of a measure) to exposing the worksheet summary card.  You can customize it to show you so many options and it’s one of the first tools I use when getting hands on with new data.

But what if you want to enhance your end-users’ capabilities and provide them with the same interaction you’re afforded in desktop?  Enter this week’s challenge: the Discovery Dashboard.  Designed off of a scatterplot, it’s goal is to give interactors the same features, insights, and tools that you passively have access to – all from Server and without the necessity of desktop or knowledge of how to develop.

This week your challenge is to recreate this guy (this is animated, so give it a moment!):

click to view on Tableau Public

Requirements

  • Dashboard size: 1100 x 900; 4 sheets tiled
  • Create a scatterplot of Sales vs. Profit with Segment on color
  • Create BAN of total marks, total sales, total profit
    • Include supporting information (min, max, slicing information)
  • Create controls that allow the user to
    • Change how the data is sliced (scattered)
    • Separate out segments to different rows
    • Separate out years to different columns
    • Add or remove reference lines
  • Match titles of each axis
  • Match tooltips
  • BANs should respond to selection inside of the scatterplot
  • Don’t forget the color legend & line formatting!

Data from this week comes from the Saved Data Source in Tableau 2018 (Sample – Superstore), download here if needed.

After you finish your workout, share on Twitter using the hashtag #WorkoutWednesday and tag @AnnUJackson, @LukeStanke, and @RodyZakovich.  (Tag @VizWizBI if you have space, he would love to see your work too!)

Also, don’t forget to track your progress using this Workout Wednesday form.

Solution: Paying The President

We’re working on providing different solutions for the rest of the year. While it’s not a guarantee that we’ll have one every week, we want to dispel any myths around the difficulty of the problems.

Last week Curtis made a video on how he created the solution. He’s going to do this every week. Curtis didn’t get it perfect but that’s okay it’s really close!

I’m not going to show you how to do every part, but I will show you a few tips that will get you going!

First let’s review the modified brief that I’ll use for this demo:

  • Dashboard size: 900px x 620px.
  • Background color: #F9F8F7
  • The data has unknown dates. Make all unknown values show up 3 months past the maximum date. If you need help see SPOILERS #1 below for the formula.
  • Create the stacked rectangle plot at the Source level. Use Size to size the boxes. Place a space of 0.01 between each of the squares. Make sure the order of the boxes matches, too. *This is the key challenge this week*
  • Create an “axis” that labels the start of each year as black and abbreviated month labels of April, July, and September, respectively. Also label the unknown values with “Unknown”. See SPOILERS #2: for help with the “axis”. And see SPOILERS #3 for the month label.
  • Color by source_group: Donald J Trump For President: #F7C480, Other: #76B7B2, Taxpayers: #555555
  • Add annotations for when Trump announced candidacy, gets nomination, the election, and inauguration. You’ll want this: ▼
  • Add the annotation around incomplete/missing data.
  • Add the divider and bracket on the dashboard.
  • Match tooltips.
  • Credit the original authors/designers and link to the original:
    Originally by Derek Kravitz and Derek Willis, ProPublica, and Paul Cronan, Mark Schifferli and Charlie Smart, Fathom Information Designhttps://projects.propublica.org/paying-the-president/.

So were talking about just 3 points. And I give you help with two of them!

Step 1: Unknown Dates

First you need to figure out the unknown dates.

IFNULL([Date], DATEADD("month", 3, {MAX([Date])}))

Put this on Columns and make it date value at the month level.

You’ll end up with this:

Step 2: Create mark logic + add level of detail.

Next were going to figure out the spacing for the marks. The formula utilizes the height of each square and then adds .01. After that we subtract half the hight of the square to center the mark where it should be. The final formula looks like this.

RUNNING_SUM(SQRT([Size]) + .01) - SQRT([Size])

Set your mark type to square and it produces this visual:

The sizing calculation before the appropriate marks are ordered on the marks card.

Next up: Let’s add the correct level of detail to the marks card. Add exact date, source to detail. Source (group) to color, and Size to size. That will give you an imperfect visual where you need to edit the table calculation (be sure to re-order the values).



Once you have edited this you end up with this visual:

It’s almost there!

It’s so close!

Step 3: Dual Axis of MIN(-3) and format.

So were basically there already. Now come’s the trick with the axis. I created a dual axis chart with the second value just an in-line calculation of MIN(-3). Synchronize this and remove all the values from this marks card.

After that you just need to create two calculations. One for the bold font and one for the gray font. Then place these on text on the marks card and format.

Years calculation (also in spoilers):

IF MONTH([Date]) = 1
OR DATETRUNC("month", [Date]) = {MIN(DATETRUNC("month", [Date]))}
THEN STR(YEAR([Date]))
ELSEIF DATETRUNC("month", [Date]) = {MIN(DATETRUNC("month", [Date]))}
THEN "Unknown"
ELSE "" END

Month Calculation: 

IF DATETRUNC("month", [Date]) != {MIN(DATETRUNC("month", [Date]))}
THEN IF MONTH([Date]) = 4
    THEN "APR"
    ELSEIF MONTH([Date]) = 7
    THEN "JUL"
    ELSEIF MONTH([Date]) = 10
    THEN "OCT"
    ELSE ""
    END
ELSE ""
END

Now we just add these to text on marks and format like this:

Year and Month labels.

Then we have this:

Note the faux axis labels.

Step 4: Format

Finally we need to revers our axis, hide our axes, and format. Then we end up with the final product looking like this:

Not bad.

Not bad for 4 steps!

Week 37: Recreating Paying the President

Challenge

This week we’ve partnered with Makeover Monday to examine potential conflict of interest between President Trump’s personal holdings and his campaign staff and government officials using data from Propublica. We’ll also be giving you a few formulas so you can focus on the important parts of the challenge: “stacking” the squares and placing the labels of year, month, and unknown on the “axis”.

click to view on Tableau Public

Setup

1. Create a calculated field called Size. Size will be used to size the squares. The size of the squares represents the overall area of the symbol. There are five different values each representing a different threshold of amount spent at a property.

IF SUM([Amount]) < 1000
THEN 1
ELSEIF SUM([Amount]) <10000
THEN 4
ELSEIF SUM([Amount]) < 100000
THEN 9
ELSEIF SUM([Amount]) < 1000000
THEN 16
ELSE 25
END

Requirements

  • Dashboard size: 900px x 620px.
  • Background color: #F9F8F7
  • The data has unknown dates. Make all unknown values show up 3 months past the maximum date. If you need help see SPOILERS #1 below for the formula.
  • Create the stacked rectangle plot at the Source level. Use Size to size the boxes. Place a space of 0.01 between each of the squares. Make sure the order of the boxes matches, too. *This is the key challenge this week*
  • Create an “axis” that labels the start of each year as black and abbreviated month labels of April, July, and September, respectively. Also label the unknown values with “Unknown”. See SPOILERS #2: for help with the “axis”. And see SPOILERS #3 for the month label.
  • Color by source_group: Donald J Trump For President: #F7C480, Other: #76B7B2, Taxpayers: #555555
  • Add annotations for when Trump announced candidacy, gets nomination, the election, and inauguration. You’ll want this: ▼
  • Add the annotation around incomplete/missing data.
  • Add the divider and bracket on the dashboard.
  • Match tooltips.
  • Credit the original authors/designers and link to the original:
    Originally by Derek Kravitz and Derek Willis, ProPublica, and Paul Cronan, Mark Schifferli and Charlie Smart, Fathom Information Design

    https://projects.propublica.org/paying-the-president/.

 

Dataset

This week uses a modified version of Spending at Trump Properties from Propublica (original data here – don’t use this one). You can get it here at data.world.

 

Share

After you finish your workout, share on Twitter using the hashtag #WorkoutWednesday and tag @AnnUJackson, @LukeStanke, and @RodyZakovich.  (Tag @VizWizBI too – he would REALLY love to see your work!)

 

Track your progress

Also, don’t forget to track your progress using this Workout Wednesday form.

 
 

 
 

#SPOILERS

1. For those still learning here is the formula for the spacing the unknown values three months out from the last known month:

IFNULL([Date], DATEADD("month", 3, {MAX([Date])}))

 
2. For those still learning here is the formula on how to create the faux axis:

IF INDEX() = 1
THEN -3
END

Using this INDEX() function allows to only show a single mark and not have a bunch of overlapping marks per month.

3. For those still learning here is the formula for creating the month label:

IF DATETRUNC("month", [Date]) != {MIN(DATETRUNC("month", [Date]))}
THEN IF MONTH([Date]) = 4
    THEN "APR"
    ELSEIF MONTH([Date]) = 7
    THEN "JUL"
    ELSEIF MONTH([Date]) = 10
    THEN "OCT"
    ELSE ""
    END
ELSE ""
END

Week 36: Scatter Plot Reference Bands

Hello again everyone! This week we are looking to add Reference Bands to our Scatter Plots in order to “group” together like items. Looking at NBA Players Total Games and Points spread.

Click to view interactive version

Requirements:

  • Dashboard size 920 x 825
  • Players are grouped into 5 bins by Avg Points per Game
    • 10-14, 15-19, 20-24, 25-29 and 30-34+
    • Must create an interactive legend on the top right that can be used in a Dashboard Highlight
  • The “Bands” are based on these bins from the Minimum number of points over X games to the Maximum number of points over X games.
  • The Y Axis (Total Points) is fixed at 17,980 to 39,900 | The X Axis (Games) is fixed at 715 to 1667
  • By default, the Top 10 Players (by points scored) will have Text Labels with their Rank, and name
  • When highlighting players using the Points Bin Legend, only show Text Labels for the players in that bin
  • Players that are marked as “active” should have a circle with an outer ring to separate them from inactive players.

Data from this week comes from Basketball-Reference via Jeff Planter. You can download the aggregated data here

After you finish your workout, share on Twitter using the hashtag #WorkoutWednesday and tag @AnnUJackson, @LukeStanke, and @RodyZakovich.  (Tag @VizWizBI too – he would REALLY love to see your work!)

Also, don’t forget to track your progress using this Workout Wednesday form.