简体   繁体   中英

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. Is there any way to display it? I tried table layout >> show empty rows and columns and it didn't work

data    calculation
1             one
2             two

Tableau discovers the possible values for a dimension field dynamically from the query results.

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? 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:

  • 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

  • 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

  • for numeric types, you can create a bin field that will automatically pad for missing bins

  • 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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