用维度值tableau计算行计数

发布于 2025-02-10 22:02:14 字数 240 浏览 1 评论 0原文

我想创建一个计算出的字段,以显示列/尺寸atemension_code ==死亡时显示数字。

例如:在1000行中,如果400行有at at at at at up code ==死亡,那么我只想显示一个大数字400。

如果我给出count(outcome_code =='death'),那只是在计数总数的行数表并显示1000。

在这种情况下如何创建计算出的字段,我不想要一个值表,我只想显示数字,因此需要一个计算的字段。

I want to create a Calculated field to display a Number when the Column/Dimension Outcome_Code == Death.

EX: Out of 1000 rows if 400 rows has Outcome_Code == Death, then I just want to to display a big Number 400.

If I give COUNT(Outcome_Code == 'Death'), it is just just counting total number of rows in the table and showing 1000.

How to create a Calculated field in this case, I don't want a table of value counts, I Just want to display the number, so want a calculated field.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谁许谁一生繁华 2025-02-17 22:02:14
SUM(INT([Outcome_Code] = "Death"))

最内向的表达是布尔值的表达。函数int()是一种类型的转换函数,将布尔值转换为整数 - 如果布尔值为真,则评估为1,如果为false,则评估为0。您可以在计算的字段中删除总和,并在愿意的情况下将其应用于架子上。

值得一提的是要认识到布尔表达是一流的表情,并且可以像数字表达一样自然地对待。其他类似的表达方式是:

MAX([Outcome_Code] = "Death") 

如果任何数据记录对[atemocty_code]的“死亡”

,则该评估为真,并且

MIN([Outcome_Code] = "Death") 

如果所有数据记录都具有“死亡” [atumocky_code]

最后两个利用了Tableau将真实视为更大的事实 - 您可以从中得出Min的含义,并将最大含义应用于Boolean Expressions

SUM(INT([Outcome_Code] = "Death"))

The innermost expression is a boolean valued expression. The function INT() is a type conversion function that converts boolean values into integers -- evaluating to 1 if the boolean value is True and 0 if it is False. You can leave off the SUM in the calculated field and apply that on the shelf instead if you prefer.

It's worth the effort to realize that boolean expressions are first-class expressions, and can be treated just as naturally as numeric expressions. Other similar expressions are:

MAX([Outcome_Code] = "Death") 

which evaluates to True if ANY data records have "Death" for an [Outcome_Code]

and

MIN([Outcome_Code] = "Death") 

which evaluates to True if ALL data records have "Death" for an [Outcome_Code]

The last two take advantage of the fact that Tableau treats True as greater than False -- from which you can derive the meaning of MIN and MAX applied to boolean expressions

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文