Tableau table hides categories with no data - how to prevent? - tableau-api

I have Tableau report where I am showing data by category in columns.
The table shows all columns when there is no filter on data. But when filter is applied, some of the categories do not have data, so table shrinks, hiding columns without data
Is there a way to always show columns regardless of data or not in that column?
Please see screenshots below.

Go to Analysis >Table layout> Show columns with no data or
Analysis>Table layout>Show rows with no data

The next step depends on whether your "disappearing" fields are dimensions or measures.
If you want to force the display of members for specific dimensions, then one (kind of complex) solution is to use an advanced Tableau feature called data blending to force the existence of dimension members, even if there are no related measure values. The trick is to make a simple data source, say a text file, that lists the members of each dimension. Use that source as the primary data source, and make the original data source the secondary source.

Go to Analysis >Table layout> Show columns with no data or Analysis>Table layout>Show rows with no data
Also You can right click on header and select show missing values if you are using line chart.

Solution 1: (When you’re working with Dates or Numeric bins)
Right click on the numerical or Date column to extrapolate the missing values. As you notice in the lower part of the screenshot, this will not work on Categorical data !
Solution 2: Categorical Data
As indicated in the accepted answer, Analysis > Table Layout > Show Empty Rows will get you the same result for Categorical (Text) Data
Solution 3: Calculated Columns
If for some reason, none of the 2 above point & click solutions work, you can create calculated columns to calculate the measure for each of the Categories with the below formula and then line them up on the Columns to achieve the same result
Profit (Category 1)
IF MyColumn = "Category 1" THEN
Profit
ELSE
NULL
END
Profit (Category 2)
IF MyColumn = "Category 2" THEN
Profit
ELSE
NULL
END
Not the most convenient solution when you have hundreds of unique values in your column, but nevertheless a workaround !

Related

Function to call the Name of a column in TABLEAU

I have a problem with Tableau.
I have a Dataset with some rows and some columns. I want to write a IFELSE structure where
The IF condition is that the Value of special field(fixed by a row and a column) is equal to the header of a column (it is every time equal to one name(header) of the different columns).
So to summarize: one value is every time equal to the name of a column and to find the column shall be the if-structure
Does someone know if there is a function to call the name (header) of a column? I didn't find it
Here is an small example, in which the Calculated_function choose the right price according to the Barcode. Everything in the first raw, is the header_name of the column below. enter image description here
Best regards
Jonas
You can work like this.
I created a sample dataset as given by you
Step-1: Connected With data in tableau. Clicked all columns having price (4 here), pivoted them so that they look like this..
Step_2: Create calculated_field like this
if [Barcode] = [Barcode_c]
then [Price] END
Step3: Filtered out null values from calculatedField and got a view like this which can be tweaked as per liking.

How to filter one source by clicking and filtering a bar chart from another source in Tableau?

I used an Apriori algorithm to view the frequent relationships in the dataset and I want to do a dashboard to better visualize this data but I don't know how to do this filter.
This is the bar chart that I created to show the support (amount of times something happend) and the confidence (probability of B happening given A) of these associations:
Apriori Chart
Next to it on the dashboard, I'll have a table with the full dataset used in this Apriori analysis where I have more information such as ID, Income, Hours Worked, etc:
Table from different data source
How can I create this relationship? The two data sources don't have a column in common that I can use for that.
I would need some way to:
Split the values in the antecedents columns by comma and filter only those columns with value equal to 1 in the other dataset
**Dataset A**
'Age Range <=30, Joblevel 1, Maritalstatus Single'
->
'Age Range <=30'
'Joblevel 1'
'Maritalstatus Single'
**Dataset B**
'Age Range <=30' == 1
'Joblevel 1' == 1
'Maritalstatus Single' == 1
Clicking this would filter the table next to it
Is there any way I can do this in Tableau?
You can download the tbwx i used in this example here https://community.tableau.com/servlet/JiveServlet/download/1083124-384949/Apriori.twbx
Thanks in advance for the help!
I am not able to check your twbx on the machine I'm using but I think you should be able to do this. The fields in the 2 data sources need to match so manipulate the data sources the make this happen.
For data source 1 there's a function SPLIT which will mean you are able to split the comma separated string to 3 fields.
Putting those 3 fields to the Detail shelf of your bar chart (or even Rows and hiding the header) will mean you can use them in an action filter.
Your second data source is a cross tab - post pivot. You should be able to pivot this data source. Highlight the measures and pivot them. This will give you the field Pivot Field Names and Pivot Field Values.
You only want to keep those with a value of 1 so create a calculated field
[Lookup1]: IF [Pivot Field Values] = 1 THEN [Pivot Field Names] END
Duplicate this field twice so you have Lookup1, Lookup2 and Lookup 3.
Then you should be able to action filter the table.
In the action filter set it up so SplitField1 = Lookup1, SplitField2 = Lookup2, etc.
Fingers crossed this works, I haven't been able to test so I am pulling it out of my head.

Spotfire - Filtering a Table by Values in a Calculated Column

I am trying to filter a table visualization of all of my data by looking to see if a Study Number contains Activity A. If a Study Number contains Activity A then I want to filter for all rows containing those Study Numbers even if the Activity is not A. See mock data below. In my real data set I have ~55,000 rows.
I have created a calculated to return Study Numbers if Activity= A but I am not sure where to go from there. Thanks for any help.
If(UniqueConcatenate([Activity]) OVER ([Study Number])~="A","Y","N")
Will give you this resulting column that you can then filter on (or you can use the formula as a Data Limiting Expression:

can't figure out how to assign column from Dim table to measures group

DW is written in foreign language so i translated it on pictures.
It is about some facility where you can rent rooms and equipment.
In Fact table i have one measure column which represents number of reservations and it works as expected, problem is in DimPayment table i have columns PaymentSum and PaymentSumWDiscount which i would need to use as measures. i tried to do something in calculations tab but i only get null values
I can't figure out how to use columns PaymentSum and PaymentSumWDiscount
as measures
i tried to do something in calculations tab but i only get null values
JOIN the FactReserving table to the DimPayment table in the Data Source View and then you can access those two columns in the Measure group.
It looks like you want to use your Dimension attributes as measure.
One way to achieve this is to make your Dimension table as a Measure Group as well.
The following example works with the AdventureWorks sample to create a measure group for the Product table:
In Visual Studio / SSDT, open your Cube, create a new Measure Group and select your table. (for your scenario, it would be the DimPayment table).
Your dimension usage mapping for this would be 'Fact' as both your fact and dimension are in the same table.
Now, you should be able to use the measures normally.
All the numeric fields automatically added as measures:
Using it as a measure:

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