简体   繁体   中英

Tableau Desktop: How to show number label and percentage label separately?

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.

画面

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.

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM