Hi Tushar, that works well with the example I sent, but my actual data set has hundreds of variables within Clinical Class 2, so that wouldn't work because the legend would be huge.
Overall what I was trying to do was wrap the text and only show the highest Clinical Class 2 for each Clinical Class, so for Respiratory only show the label for the Clinical Class 2's that have the highest counts, and same for Nervous and Injury. The issue comes up when in this example Respiratory Clinical Class 2 has two labels that have the same # of counts, so their labels both show, which is what I would want, I just wouldn't want them to overlap the way they are now.
This may be too round-about, but you can try calculating your own breakpoints.
This doesn't take into account all situations, but maybe it can give an idea.
The idea is that if the text extends over some predeteremined length,
then break at a midpoint space.
-count the number of spaces:
LEN([Clinical Class 2])-LEN(REPLACE([Clinical Class 2]," ",""))
-find the middle number of spaces:
-first part of string;
IF LEN([Clinical Class 2])<40 // I set length arbitrarily at 40
THEN [Clinical Class 2]
ELSE MID([Clinical Class 2],1,FINDNTH([Clinical Class 2]," ",[BreakPoint]))
-second part of string
IF LEN([Clinical Class 2])<40
ELSE MID([Clinical Class 2],FINDNTH([Clinical Class 2]," ",[BreakPoint]),LEN([Clinical Class 2]))
Then both can be placed on the Label Shelf.
I set the length arbitrarily at 40 but you can maybe make a calculated field
to determine the best length.
There are many other factors not taken into account here:
dashboard size, actual size of the bar, etc.
There are probably calculated fields that could further refine.
Please see workbook v18.1 attached in the Forum Thread.
284982wrap.twbx 25.4 KB
That actually works pretty well! I'll play around a bit with seeing if I can split the label into 3 separate lines as well. Thank you!!