top of page

Creating an Nth Label

Have you ever tried to put labels on your line graph and you were not happy with the default options of All, Min/max, Line Ends, Selected, Highlighted or Most Recent? Did you know there is a trick to showing more labels without bombarding your dashboard with the visual label clutter? This tip was suggested by Harry Smith. Thanks Harry!

I have the below line graph in my dashboard which is created the Superstore data set. I am using the Order Date for the Columns and Sales for the Row data.

As you see with Sum(Sales) on the Label Marks card displaying All labels, and the graph looks quite cluttered.

I created the below calculated field in Tableau;

Index Label

IF index()/4=int(index()/4 THEN sum([Sales]) END

I replaced the SUM([Sales]) Label with this calculated field. It changed the labels as shown below;

What if you created a parameter where the user could change how many labels they want to see?

I created a Label Parameter with a set range as shown below;

  • Data type - Integer

  • Current value - 3

  • Allowable values - Range

  • Minimum - 2

  • Maximum - 10

I then created the following calculated field;

Parameter Index Label

IF index()/[Label Parameter]=int(index()/[Label Parameter])

then SUM([Sales]) END

I displayed the parameter on the worksheet and then replaced the Index Label calculated field with the Parameter Index Label field.

Now your user can set their label intervals with the parameter;

Please note: Each time you swap a metric on the Label marks card, you will need to reformat it as currency.

547 views0 comments


bottom of page