I want to show the number label in green bar and percentage label in orange bar such that the number and percentages remain the same but just show in the desired place. Is there a way we can do that in tableau? The number label is calculated as TOTAL(SUM(Number of Records)) whereas the colored bars belong to a dimension with two different criteria and I have made a quick table calculation to show the percentage of total along the cell.
0
votes
1 Answers
0
votes
Create a calculation for the label uses an IF statement. I did something with the Sample Superstore that is similar. Below is a calculation for My Label, which I put on the label shelf. I then had to right click on that My Label's pill in the Marks card and change the Compute Using to Ship Mode.
IF ATTR([Ship Mode]) = 'First Class' THEN
STR(TOTAL(COUNT([Orders])))
ELSEIF ATTR([Ship Mode]) = 'Same Day' THEN
STR(ROUND(100 * COUNT([Orders]) / TOTAL(COUNT([Orders])), 0)) + '%'
END
As you can see, I had to do my own formatting of the percentage.