3 Replies Latest reply on Dec 20, 2013 11:57 AM by Matt Lutton

# Calculated fields for labeling

I have two data fields that rate confidence levels from 1 to 5. I'm displaying each on a single bar chart.

I would like to add a label or a tooltip element that adds a description for the numerical values. This works if I'm displaying only the confidence indicator bar:

if [confidence scale] = 1 then "Unknown"

elseif [confidence scale] = 2 then " 'Guesstimate' "

elseif [confidence scale]=3 then "Informed estimate"

elseif [confidence scale]=4 then "Informal disclosure"

elseif [confidence scale]=5 then "Formal disclosure"

end

Similarly, the following works if I'm displaying only the future trend bar:

if [future trend)] = 1 then "Strong downward"

elseif [future trend] = 2 then "Weak downward"

elseif [future trend] =3 then "Flat"

elseif [future trend)] =4 then "Weak upward"

elseif [future trend)] =5 then "Strong upward"

end

Tableau accepts this syntax when I try to combine them, but the result is not what I want:

if [Total confidence level 1-5 scale] = 1 then "Unknown"

elseif [Total confidence level 1-5 scale]= 2 then " 'Guesstimate' "

elseif [Total confidence level 1-5 scale]=3 then "Informed estimate"

elseif [Total confidence level 1-5 scale]=4 then "Informal client disclosure"

elseif [Total confidence level 1-5 scale]=5 then "Formal client disclosure"

elseif [Total wallet future trend (1 to 5)] = 1 then "Strong downward"

elseif [Total wallet future trend (1 to 5)] = 2 then "Weak downward"

elseif [Total wallet future trend (1 to 5)] =3 then "Flat"

elseif [Total wallet future trend (1 to 5)] =4 then "Weak upward"

elseif [Total wallet future trend (1 to 5)] =5 then "Strong upward"

end

How do I get Tableau to add the appropriate label (or tooltip element) to the appropriate bar?

Many thanks.

• ###### 1. Re: Calculated fields for labeling

One option would be to place the two bars on separate sheets, then combine them into one dashboard container.  Or a dual axis might accomplish the same thing.  But without seeing your packaged workbook or data structure, it is hard to say what the best approach might be.

1 of 1 people found this helpful
• ###### 2. Re: Calculated fields for labeling

Thanks for the suggestion. I used the two-sheet, one-container approach.

• ###### 3. Re: Calculated fields for labeling

Not a problem.  If you have a packaged workbook, I can take a look at trying a different method but without seeing the data or at least the pill arrangement in the view, I'm not sure how to advise you in any other direction.