Labels on selected columns in column chart

Here is a column chart with standard labels:


If you have a column chart like this, maybe you would like to apply the labels - not to all columns, but just to one column or a few selected columns.

I am going to do this by use of two TARGIT features:

  • An added calculation that will return either '1' or '0'
  • An advanced label - using 'conditional text' to show labels where the calculation equals '1'


Example 1: Label on last column only

Calculation (Label flag), added as calculated column:

if allcount(d1, d-1:0, m1) = 1 then 1 else 0

The column chart, viewed as a crosstab would then look like this:


You might want to hide this calculation right away (from Properties / Visibility). Even if hidden, you can still refer the calculated values later on.


Next step is to start working with the 'Advanced text editor' for labels of the column chart:


Remove any content of the editor field and add a 'New conditional text':


  • In the 'If' box, add Value for the calculation - in this example, Value 2 (Label flag).
  • Press the 'Apply' button next to the 'If' box.
  • In the 'Then' box, add MeasureValue.
  • Press the 'Apply' button next to the 'Then' box.


Now, this should result in seeing the label on the last column only:



Example 2: Labels on first and last column only

The nice thing about the previous preparations, is that now you only need to change when the calculation should result in '1' or '0' to apply labels on other columns of your choice.

To get labels on first and last columns only, change the Label flag calculation to this:

if (allcount(d1, d-1:0, m1) = 1 or allcount(d1, d1:0, m1) = 1) then 1 else 0

To get a result like this:


Example 3: Labels on every third column

mod(allcount(d1, d1:0, m1);3)


Example 4: Labels on highest an lowest columns

if (sum(d1, 0, m1) = min(d1, all, m1) or sum(d1, 0, m1) = max(d1, all, m1)) then 1 else 0

Was this article helpful?
1 out of 1 found this helpful



Please sign in to leave a comment.