简体   繁体   English

即使类别不可见,tableau 也会显示计算中的类别

[英]tableau show categories from calculation even when a category is not visible

I have a calculation and it outputs multiple values.我有一个计算,它输出多个值。 Then I am creating a table on those values.然后我正在创建一个关于这些值的表格。 For example, in below data my formula is例如,在下面的数据中,我的公式是

if data is 1 then calculation is `one`
if data is 2 then calculation is `two`
if data is 3 then calculation is `three`

as three doesn't really appear in the output, when I create a table, three is not displayed.由于three并没有真正出现在输出中,所以当我创建一个表时, three没有显示。 Is there any way to display it?有什么办法可以显示吗? I tried table layout >> show empty rows and columns and it didn't work我尝试过table layout >> show empty rows and columns ,但没有用

data    calculation
1             one
2             two

Tableau discovers the possible values for a dimension field dynamically from the query results. Tableau 从查询结果中动态发现维度字段的可能值。

If 'three' does not appear in your data, then how do you expect Tableau to know to make a column header for that non existent, but potential, value?如果“三”未出现在您的数据中,那么您如何期望 Tableau 知道为该不存在但可能的值制作列标题? It can't read your mind.它无法读懂你的想法。

This situation does occur often though - perhaps you want row or column headers to remain stable, even when you change filters in a way that causes some to no longer appear in the query results.但是,这种情况确实经常发生 - 也许您希望行或列标题保持稳定,即使您更改过滤器的方式导致某些不再出现在查询结果中。

There are a few ways you can force Tableau to pad ** or **complete a domain:有几种方法可以强制 Tableau填充 ** 或 ** 完成域:

  • one solution is to pad your data to make sure each value for your dimension field appears in at least one data row.一种解决方案是填充数据以确保维度字段的每个值至少出现在一个数据行中。

You can often do this easily by using a union to append some extra rows to your original data.您通常可以通过使用联合将一些额外的行附加到原始数据来轻松完成此操作。 You can often add padding rows that don't impact any results by leaving all your Measure columns null since nulls are ignored by aggregation functions您通常可以通过将所有 Measure 列保留为空来添加不影响任何结果的填充行,因为聚合函数会忽略空值

  • Another common solution that is a bit more effort is to make what is known as scaffolding data source that is not much more than a list of your dimension members.另一个需要更多努力的常见解决方案是制作所谓的脚手架数据源,它只不过是一个维度成员列表。 You can then use that data source as a primary data source with data blending, making your original data source secondary.然后,您可以将该数据源用作数据混合的主要数据源,使您的原始数据源成为次要数据源。

There are two situations where Tableau can detect the absence of data and leave space for it in the visualization automatically Tableau 可以在两种情况下自动检测到数据缺失并在可视化中为其留出空间

  • for numeric types, you can create a bin field that will automatically pad for missing bins对于数字类型,您可以创建一个 bin 字段,该字段将自动填充缺失的 bin

  • similarly, date fields can show missing values because, like bins, Tableau can tell when a month doesn't appear in the data and leave room for it in the view类似地,日期字段可以显示缺失值,因为与 bin 一样,Tableau 可以判断月份何时未出现在数据中并在视图中为其留出空间

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

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