Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
839 views
in Technique[技术] by (71.8m points)

visualization - Display percent by category in tableau

I have a dataset in tableau where I would like to show the percent of each category.

Data

free    use type    date
10      5   A1      1/1/2021
20      1   A1      1/1/2021
40      2   B2      1/1/2021
60      3   B2      1/1/2021

Desired

   type      %

   A1      50%
   B2      50%

Doing

enter image description here

SUM( [type] ) / SUM( [type] )

However, because 'type' is a string, the calculation is not successful. Is there a way to showcase a groupby and to display the percent? Any suggestion is appreciated


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Assuming that you are trying to get the percent of rows per "type", you can

  1. Drag your "Book1.csv (Count)" to your Text marks card
  2. From the marks card, click Percent of Total

Alternatively you can create a calculated field containing COUNT([Book1.csv]) / TOTAL(COUNT([Book1.csv]))

Example output from Superstore Dataset


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...