简体   繁体   English

Tableau 计算字段以按排序顺序显示位置

[英]Tableau Calculated Field to Display Placement in Sort Order

I am making a dashboard to rank the performance of employees based on around 20 metrics.我正在制作一个仪表板,根据大约 20 个指标对员工的绩效进行排名。 I am wondering if I can create a calculated field that will output the placement they have in a descending sort of that metric.我想知道是否可以创建一个计算字段,该字段将以该指标的降序输出它们的位置。

For example, if they are 13th out of 20 employees based on accuracy, the field would output 13.例如,如果根据准确性,他们是 20 名员工中的第 13 名,则该字段将输出 13。

Is this possible?这可能吗?

Thank you,谢谢,

Andrew安德鲁

I think you're just looking for the rank function: rank([metricname]) , assuming that metricname is the result of an aggregation.我认为您只是在寻找排名函数: rank([metricname]) ,假设metricname是聚合的结果。 If not, wrap [metricname] in whatever function is applicable (ie sum, max, etc)如果不是, [metricname]包装在任何适用的函数中(即 sum、max 等)

By default, rank() works in descending order, although this can be changed by passing in the asc argument after the expression.默认情况下, rank()按降序运行,尽管这可以通过在表达式后传入asc参数来更改。

To make this dynamic: Create a parameter that contains all of your metric names, along with a metric that says IF [parametername] = "metric1" then [metric1] ELSEIF [parametername] = "metric2" then [metric2] END and use that as the argument within the call to rank()要使其动态化:创建一个包含所有指标名称的参数,以及一个表示IF [parametername] = "metric1" then [metric1] ELSEIF [parametername] = "metric2" then [metric2] END然后使用该指标作为调用rank()

Here's an article that explains this very well: http://kb.tableau.com/articles/knowledgebase/parameterized-measure这里有一篇文章很好地解释了这一点: http : //kb.tableau.com/articles/knowledgebase/parameterized-measure

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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