Data Viz Done Right

March 28, 2018

Workout Wednesday: Color and Ordering

This week Rody challenged us to create a tabular view that has three columns, only one of which is colored and the user needs to be able to sort by a given year and metric. Find the full requirements here.

I had done something like this previously for the color. What tripped me up was the sorting calculation. It's not overly complicated. The only hint I'll provide is that you can't sort the subcategory by this calculation. Click on the image below for the interactive version.


  1. Hi. I used a parameter and created a calculated field that picks one of Sales, % of total, % difference based on what value the parameter holds. I was able to perform sorting correctly and my numbers matched this viz, but I got the numbers for the selected year in a different row. Numbers for the selected year were blank in the row that contained numbers for the other 3 years. I see Randy has used -window_max function, and selected the 'Sort' calculated field in Nested Calculations. Can you please explain why and what that means?

  2. It's Andy, not Randy :-) I use the -window_max as a discrete field so that I can sort alphabetically. The minus makes the largest value the smallest value, thus when I sort alphabetically, it generates a sort descending.