简体   繁体   English

Tableau 计算字段 - 分类

[英]Tableau calculated field - classifying

Hi I am a Tableau beginner and need some help.您好,我是 Tableau 初学者,需要一些帮助。

I have a sheet that looks like this.我有一张看起来像这样的床单。

ID    Type
27    A
      B
38    B
19    A
      B
28    A
      B
18    A
29    A
      B

For an ID, if the type is A and B, I want to classify it as A. So desired result is this.对于一个ID,如果类型是A和B,我想把它归类为A。所以想要的结果是这样的。

ID    Type
27    A
38    B
19    A
28    A
18    A
29    A

I can't just say 'if type = A and B then A' because there are some other fields involved in where I need to both to show.我不能只说'if type = A and B then A',因为还有一些其他字段涉及到我需要同时显示的地方。

I need to a calculated field that will allow me to tie this condition to the ID field specifically.我需要一个计算字段,该字段允许我将此条件专门与 ID 字段联系起来。

One way you could do this is with an LOD calculation.一种方法是使用 LOD 计算。 Something like this should do the trick:这样的事情应该可以解决问题:

IF {FIXED [ID] : MAX([Type] = "A")}
AND {FIXED [ID] : MAX([Type] = "B")}
THEN "A"
ELSE [Type]
END

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

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