June 27, 2016
The Data School Gym - Displaying KPIs Next to Bars
Here’s another Data School Gym challenge for you. I’ll create a video tomorrow for how to solve it. First, let me explain the problem.
I’ve written before about how to use ASCII indicators to compare to a goal.
But there are times when we might want the indicator as part of the chart next to the bars. Start by creating a year over year comparison like this:
Then create a calculated field as a placeholder:
Add the Placeholder as the secondary axis and synchronize. Then create a calculation that compares the two years:
Change the mark type to shape for the Placeholder axis and add the comparison calcuation to the Shapes shelf and the Color shelf. Change the shape and color to something more meaningful.
Then right click on “True” on either the Shape or Color shelf and choose “Hide”. This cleans up the viz nicely. Go ahead and hide the secondary axis while you’re at it.
Ok, looks good. However, what happens when we add another dimension?
The indicator is fixed to -50,000 so now there’s a wider gap between the indicator and the bar (because the value of the primary axis is smaller).
Here’s the challenge:
Notice how in each of the screenshots below, the arrow is always precisely the same distance from the left side of the bar. That’s the tricky bit.
You can download the same version of Superstore Sales that I used for this example here.