A ratio measured within one dimension shown across another dimension

故事扮演 提交于 2019-12-24 19:19:00

问题


For the sake of the exercise, let's assume that I'm monitoring the percentage of domestic or foreign auto sales across the US.

Assume my dataset looks like:

StateOfSale | Origin | Sales
'CA' | 'Foreign' | 1200
'CA' | 'Domestic' | 800
'TX' | 'Foreign' | 800
'TX' | 'Domestic' | 800

How would I show the percentage of Foreign Sales, by State of Sale, but each State is a line/mark/bar in the visual?

So for CA, the Foreign Percentage is 60%. For TX, the Foreign Percentage is 50%.


回答1:


This is what Tableau was born to do!, and there are a lot of great ways to visualize this type of question.

Use a Quick table calculation called "Percent of Total" and compute that percentage according to each State. In the picture below, "StateofOrigin" is in Columns, and "Sum(Sale)" is in Rows, I compute using Table (Down).

You can also graph the raw sales numbers in addition to displaying the text percentage to gain additional context about the number of sales between states.

Finally, if you've got a lot of states, it can be cool to plot it out on a map. You can do this by creating a calculated field for percentage and then filtering out the domestic sales.

Field Name: Percentage

SUM([Sale])/SUM({FIXED [StateofOrigin]: SUM([Sale])})



来源:https://stackoverflow.com/questions/45683111/a-ratio-measured-within-one-dimension-shown-across-another-dimension

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!