简体   繁体   中英

How to include Percentage in ToolTip in Tableau Public

I created the below view that gives No. of students got PASS/FAIL in each subject . The tool Tip gives me some default options.

But I would like to have Percentage in tool tip

Basically I need Percentage field in tooltip that says 50% for below screen.

PASS Percentage 50%

FAIL Percentage 50%

This Percentage field needs to vary as per each subject and its grade among students

通过/失败按主题计数

Could somebody help me on steps to include Percentage in Tooltip?

sample dataset

id  name    age gender  subject grade
100 Steve   14  MALE    ENGLISH PASS
100 Steve   14  MALE    PHYSICS PASS
100 Steve   14  MALE    CHEMISTRY   PASS
101 Edward  15  MALE    ENGLISH FAIL
101 Edward  15  MALE    PHYSICS FAIL
101 Edward  15  MALE    CHEMISTRY   FAIL
102 Andy    15  FEMALE  ENGLISH PASS
102 Andy    15  FEMALE  PHYSICS PASS
102 Andy    15  FEMALE  CHEMISTRY   FAIL
103 Kim 16  FEMALE  ENGLISH FAIL
103 Kim 16  FEMALE  PHYSICS FAIL
103 Kim 16  FEMALE  CHEMISTRY   PASS

Table calcs let you calculate percent of totals without creating new calculated fields.

Put SUM(Number of Records) on the Tooltip shelf. Then click on it and choose Quick Table Calc->Percent of Total. You will see a triangle icon next to the field indicating it is now a table calculation

Experiment with changing the Compute Using setting for the Field. I believe compute using Grade is probably the one you want.

I did this with a few calcs. First, get the PASS count.

if [Grade] = 'PASS' then 1 END

Then create a Pass % calc.

sum([Pass count]) / total(countd([Id]))

Now you can place this field in the Tooltip. Repeat for FAIL as well and place that in the Tooltip.

Then I updated the tooltip as follows:

Number of students <CNTD(Id)> (<AGG(pass %)> <AGG(fail %)>) who got a <Grade> in <Subject> 

see sample workbook here for details. https://dl.dropboxusercontent.com/u/60455118/160326%20stack%20question.twbx

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