Workout Wednesday 2021 – Week 4

This week’s challenge is a throwback to a challenge from a couple years ago, but with a new functionality wrinkle to try out the new Map Layers in Tableau 2020.4. Seems like Sean is often coming up with challenges to help with learning new functionality in Tableau, which is awesome. The challenge itself was fairly simple, particularly because of the great work from Tableau devs in creating Map Layers.

I started off adding Longitude (generated) to Columns and Latitude (generated) to Rows. Then I added State to Detail for the filled map portion. After that I dragged City into the view, and a nifty new thing popped up:

I dropped city on, and now I have two Marks Cards:

Now, with City and State in the view, I added SUM(Profit) to Orders.State Color, and matched Sean’s Red-Black diverging palette. Then I added SUM(Profit) to Size for Orders.City. But since we’re adding color to show positive/negative profit, we need the scale to start from zero, rather than the smallest number:

Now I need a calculation to identify whether each city is profitable or not. So I just created a boolean IIF statement:

Then I added that to Color in Orders.City, and matched Sean’s colors, including a white border.

I struggled for a few minutes to figure out how to make the filled states not selectable. I tried turning off the tooltips, but you could still hover on a state and have it highlight the state border, which Sean’s version wasn’t doing.

After putzing around for a bit, I came across a dropdown for the layer, that magically had Disable Selection as an item:

Magic! Next I worked on the bar chart. I noticed that it was showing the City and the State, so I needed a calc to combine the two:

The State Abbreviation here is the calculation Sean shared with us. So then I added City State to Rows, SUM(Profit) to Columns, and City Profitable to Color.

For the tooltip on both the map and the bar chart, I needed a Negative Profit value and a Positive Profit value, in order to make the negative and positive numbers different colors.

Now I can add these to the tooltip, next to each other without a space between, with the Negative value colored red, and I’ll get one or the other depending on the value for the city:

(This is the same tooltip for both worksheets)

Once I got everything on the dashboard, here’s what that layout looked like with my containers:

Then I just needed to add the highlight action so when you hover on the bar it highlights the city on the map:

And we’re done!  I was truly amazed with how simple and intuitive it was to use map layers, and glad Sean gave us this opportunity to check them out.

Click here to view in Tableau Public

Workout Wednesday 2021 – Week 1

It’s been a couple months, after a broken pinky (causing typing difficulty) and the holidays, I’m ready to start the new year. This week’s challenge is from Candra, one of this year’s new coaches. Taking it back to straight table calculations, which is always a good exercise for those of us that tend to reach straight for the LODs.

I started out creating the line chart, with Year on Columns and SUM(Food insecurity) on Rows, and changed the line color to black. I gathered from interacting with Candra’s viz that the selected year and which year to compare to were parameters, so I created those next. One as an Integer, with the values added to the list from the Year field.

The other as a String with the three values identified.

Then I created a boolean to identify the year based on the parameter selection:

Then I created another to identify the comparison year:

I used WINDOW_MIN and WINDOW_MAX to get the first and most recent years, and the Lookup Year to get the previous year to the year selected:

With the two years identified, I decided to try a dual axis to add the dots to the line chart. So I created a calc to give me the SUM(Food insecurity) if the year was Year Selected or Comparison Year Selected:

Then I added that to Rows and set the Dual Axis and Synchronize Axis. When I add Year Selected to Color for that mark, I get a T/F so I set the color accordingly.

To format the numbers, since the requirements said not to add the % with a calc, I remembered the Suffix option in the number formatting:

After formatting I did a quick setup of the tooltip:

The last thing I needed was the variance between the selected year and the comparison year. So I created a calc for the selected year value and the lookup year value:

With these two values, I could then create a variance calc. I used WINDOW_MAX in order to get just the values:

That was the last piece I needed to create the title. Since I needed to include the Selected Value and the Variance I decided to use the worksheet title:

After this, I added the sheet to the dashboard, and then floated the parameter dropdowns into the spaces in front of the Selected Year and the Lookup Year parameter values.

As an added bonus, I decided to add a parameter action that would change the Selected Year when you click on the line chart:

Then I added a TRUE/FALSE filter to automatically deselect the year when clicking on the line:

And we’re done with the first challenge of the year!

Click to view in Tableau Public