Would something like this make sense?
if your data looks like:
Shape, data_label_text triangle, good text square, more good text diamond, not to be displayed
you could create a calculated field like:
if [Shape]="triangle" or [Shape]="square" then [data_label_text] else "" end
if your data_label_text is not already a text field, you will want to wrap it with a
Place that calc field on the Text shelf, and if Tableau does not auto display the text, select all marks and turn data labels on for all marks.
Also if you have a bunch you wanted to display, and only a few to exclude, you could craft your calc like:
if [Shape]<>"diamond" then [data_label_text] else "" end
Yep - turn data labels "On (All)" and then put a calculation on the Text shelf that looks something like IIF([category] != "use diamonds", [label field],"")
Anna, Joe, and James,
Since Anna may not know ahead of time which shape she will assign to which dimension, and there is the possibility that the assignment of shape could be based on evaluation of a measure instead of a dimension, what do you all think of the two approaches explored in the attached workbook. The data is from a question elsewhere in the forums about gantt charts (sessions_gant_v2.twbx), and the views are nonsensical for that data, but they work to get the point across.
There are two views in the workbook:
Conditional Data Labels 1
In this case, there is a calculated field on the Text shelf, with the following definition:
[display text] = iif([session_type]!='complete',str(round([session_duration_days],2)),'').
So, here, a dimension field in the datasource is used to set the shape. [display text] evaluates that field, and if the dimension has certain value(s), [display text] takes on a string equivalent of a measure, otherwise, it is blank.
Conditional Data Labels 2
In this case, there are two calculated fields, one for the Text shelf and one for the Mark shelf:
Text Shelf - [duration mark data label] = iif([session_duration_days]>.1,str(round([session_duration_days],2)),''). This field functions like [display text] in the previous example; it sits on the Text shelf.
Mark Shelf - [duration mark category] = iif([duration mark data label]='', 'Normal Range','Exception'). This field sets the mark based on the value of [duration mark data label].
If this has value, James and Joe inspired. If no value, please ignore.
Peace and All Good!
data label fun.twbx 88.9 KB
Awesome, thank you so much everyone- I'll let you know what I end up with.
And by using the text "use diamonds" or "square" we just mean to imply the individual categorical values in the domain. Presumably Anna doesn't just hate diamonds, but wants to de-label a particular categorical value.
Please help me out in providing a labels in Pie Chart. the label should be like Male 55%, Female 45%.
Example - Dimension : Gender - Male and Female
Measures - Counts
Pie Chart should display both value along with its angles.
Great! One more question. I want grand total display along with title of the Chart.
Your Example Total Count is 200.
Title like this "Gender : 200"
How do i get detail information about these functions.?
Thanks for the above, it was very helpful.
Followup - Is it possible to show the count for each section of the pie beneath the percentage? For example: Male / 55% / 123. I have four separate sections of a pie, each with its own value that I would like to display beneath percentage, i.e. A / 5% / 123 :: B / 15% / 234 :: C / 25% 345, and so forth.