简体   繁体   English

Tableau 中基于另一个字段的排名

[英]Ranking in Tableau Based on another Field

How to rank based on a field where the value is the same.如何根据值相同的字段进行排名。 There is some more ranking applied here and this scenario need to be addressed as well as I can not rank again by Sales field .这里应用了更多排名,需要解决这种情况,因为我无法通过 Sales 字段再次排名 Instead, I need to say:相反,我需要说:
If Unit is the same on the list of territories, rank based on Sales.如果地区列表中的单位相同,则根据销售额排名。

Example:例子:

Terr       Sales   Unit   Should look like : Terr       Sales   Unit      
----      ------   -----                    -----------------------
Boston       1      5                        Maine      10     5
Maine       10      5                        Boston      1     5

Often a mathematical approach works well for this.通常,数学方法对此很有效。 First, without wanting to patronise, it's possible to use a discrete (blue) measure to sort data.首先,不想光顾,可以使用离散(蓝色)度量对数据进行排序。 Place the sorting pill to the far left on the Rows and the table will sort according to this pill.将排序药丸放在 Rows 的最左侧,表格将根据该药丸进行排序。

Ok, so the formula.好了,公式就出来了。 Without knowing how large the Sales figure can go, you want to create a calculation that would give the highest value to that you want to appear top.在不知道 Sales 数字可以达到多大的情况下,您想要创建一个计算,该计算将为您希望出现在顶部的那个提供最高值。

For example perhaps multiple Unit by 1,000,000 and add Sales.例如,可能将单位乘以 1,000,000 并添加销售额。 Just make sure the Units are multiplied by a number large enough to make Sales inconsequential.只需确保单位乘以一个足够大的数字,以使销售额无关紧要。

This field may work, depending how large the Sales figure can go:此字段可能有效,具体取决于销售额数字的大小:

[SortField] = (SUM([Unit])*1000000 + SUM([Sales])) * -1 [SortField] = (SUM([Unit])*1000000 + SUM([Sales])) * -1

Put the field to Rows, convert to Discrete, then place to the far left.将字段置于 Rows,转换为 Discrete,然后置于最左侧。 If the sorting is correct hide the field header.如果排序正确隐藏字段标题。

It multiplies by -1 to sort descending.它乘以 -1 以进行降序排序。

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

相关问题 多个 if 用于 tableau 中的计算字段 - multiple if's for calculated field in tableau 如何根据另一个字段的值过滤 MS Access 字段 - How to filter MS Access field based on the value of another field 根据另一个字段中的条件隐藏 SharePoint 中的字段 - Hide a field in SharePoint based on Conditions from another field 在我的 Tableau Viz 中实现计算字段 - Implementing a calculated field within my Tableau Viz Tableau IF THEN 语句 - 基于日期的更改度量 - Tableau IF THEN Statement - Change Measure Based on Date awk:根据另一列的值有条件地更改字段的值 - awk: change a field's value conditionally based on the value of another column 根据是/否字段的值将记录从一个表复制到另一个表 - Copying records from one table and to another based on the value of a yes/no field 如何针对加权因子基于多个标准对行进行排名? - How to give a ranking to rows based on multiple criteria against weighted factors? 如何根据另一个字段的条件从一个字段中拾取数据 - How to pick up data from one field based on the condition of another field Tableau-计算字段:满足多个条件时重复计数 - Tableau - Calculated Field : repeat count when multiple conditions are met
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM