Tableau 8.2: how do I sort across all item numbers? - tableau-api

I am using Tableau 8.2.
I would like to sort, but am having difficulty trying to get to my end result.
I have an item number: the item numbers are repeated multiple times.
I have a criteria1 field, and a criteria2 field.
I would like to experiment sorting on all the criteria1 fields, then all the criteria2 fields.
For my rows, I have "item number", "criteria1", "criteria2", along with other data.
When I click above the "criteria1" in the list of rows, I get a "sort" function.
The sort function has sever different combinations:
The first is "sort order", there are clicks for "ascending" and "descending".
Next is "sort by", there are clicks for "data source order", "alphabetic" and "field". The "field" has a combobox for different field names.
The last group is for "manual". This shows all values, but not in true sort order.
I have tried using many different combinations for the sort, but cannot get it to work the way I would like. I would like a sort across all the items, descending.
How can I get the sort to sort descending across all the items, first by "criteria1"? Then, how can I sort by "criteria2"?

I don't quite understand what problem you're facing. Let me explain how sorting works in Tableau, and you tell me what's happening in case it's not helpful.
Each dimension has a Sort property (you can right-click a dimension, Default Properties and Sort. You can choose to sort ascending or descending, on alphabetic, numeric or data source order. Or even manually sort (top items come first, bottom items come last, use Up and Down button to shuffle)
When you drag those dimensions to the worksheet, Tableau will automatically use that Sort Property. More over, it will follow a hierarchy, the first dimension (in Row or Column) will be sorted first, then the second dimension will be sorted inside each bucket of the first dimension. SO, if you have a field with [A,B,C,D] and a second field with [1,2,3,4], one possible outcome could be (using descending order, first the letters than the numbers):
D 3
2
1
C 3
2
B 4
3
1
A 4
3
In that example, what exactly would you be trying to achieve?

Related

In Tableau: Count entries Column B that have the same value in Column A

I have a table with two columns. For simplicity, lets say Column A is General Contractors and Column B is subcontractors. Any given general contractor can have a variable number of subcontractors. I would like to add a third column that simply displays a count of how many subcontractors each contractor has.
I have tried several calculations using "fixed" and "include" functions as well as "Count" and "CountD" functions and have tried directly using the count functions (right-click>>measure>>count) but all I get are 1's in the resulting column.
The data come from a table where there is one row for each subcontractor, so the if a general contractor had 5 subcontractors then there would be 5 rows where the general contractor repeats it self over and over with a different subcontractor next to it.
There are far too many different general contractors to use conditional statements.
Is what I'm doing possible and what other things should I try?
Try this
{Fixed [general contractor]: Countd([sub contractor]) }
Add this field to your view after contractor and sub-contractor, you'll get that variable count say 5 repeated in each row that general contractor.

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.

Show 0 for values with missing data

I have a dimension I am showing in a text table that can have one of 3 possibilities "A", "B", or "C" and I want at all times to have A, B and C shown in a text table even if one of them has 0 occurrences. The issue is that I am filtering this based on date, so it is possible that for example B may not exist, but I still want to have a 0 printed for B.
I have gone to Analysis -> Table layout -> show empty rows which will show "B", but in the count display it shows a blank. How can I get it to display a 0?
This problem is very famous among tableau users and I still did not see a generic tableau-only solution. All proper solutions start with injecting rows to your data which I assume you do not want this.
Below method will only work if you have a Date Dimension on the measure and no-data dates are not completely filtered-out; so you will be seeing zeros even though that date has no data as you may see on below screenshot.
When you filter out the no-data dates, unfortunately you will keep on seeing NULLs.
If you are using the SUM of Number of Records as your occurrences, then you may create a calculated field as below and use it in your pane:
ZN(LOOKUP(SUM([Number of Records]),0))
You can leave the Default Table Calculation as Automatic so the Results are computed along Table (accross).

Tableau find count of dimension for each of other dimension

I have 3 columns in my data "Date", CustomerID and Action Type (There are 10 different types of Action type like item hover, product click etc)
I want to eliminate those customers who has interactions of less that 20.
For example, for a customer ID say 10, if the count of all the action type against this customer is less than 20 I want to eliminate that customer. I want to do this for each ween and create a line graph may be.
Somebody please help, Although I am trying to do this in tableau but excel and access solutions are welcomed too. I have tried everything I could but still couldn't do it. My calculated field only works if I use customer Id along wth count which gives me a table that I dont want.
Assuming Action Type cannot be null, put CustomerID on the filter shelf, select the "Use All" radio button at the top of the filter panel, switch to the Condition tab, Choose "By Field", and require the SUM of the Number of Records to be >= 20
If Action Type can be null, do the same but use COUNT of Action Type instead of SUM of Number Of Records.
Filters have multiple tabs. You can see a summary of how the filter is defined at the bottom of the General tab.

Using both counts and averages in tableau

I've got some data that I'd like to display both the averages and the count for.
For instance, there are 50 People taking a survey. Their names are saved in a Dimension "Raters". They are taste testing several products. These products are saved in a Dimension "Products"
They answer 4 questions. Taste, Texture, Appearance, Uniqueness, all saved in Dimension "Question"
The actual ratings are saved in "Ratings". This is a measure.
I can very easily make a table with Raters on the Rows, Question on the Columns, AVG(Ratings) in the text.
This shows me the average score for each question the rater answered.
It looks like this:
Rater-----Taste-----Texture-----Appearance-----Uniqueness
Joe---------2.2---------4.3--------------3.7-----------------2.4
Bob--------3.0----------1.2-------------3.4-----------------4.4
Sally-------4.5----------3.3-------------4.5-----------------3.2
Jessica---5.0----------3.0-------------2.0-----------------1.0
So far, so good.
Jessica's results look suspiciously integerish. When I look at the background data, I see that she only answered for 1 product.
I'd like to be able to add a column to the right of uniqueness which is the count of all product responses for that person.
I've played with this quite a bit, and I'm not sure that it is possible. Maybe with LOD?
I'd also like to filter the table, so that only "tough" raters are shown. Criteria for this is: Their average response for at least two criteria should be below 3.0. That would include Joe and Jessica.
When I try to do counts based on averages, I run into the "cannot aggregate an aggregate rule".
Is there a way around this? It would be trivial to do in excel with another column, a countif, and a filter.
Thanks,
Chris
Part 1:
You should be able to create a calculated field(Analysis->Calculated Field) and name it something like "Number of Records". In the query box just set it to 1 and select "Okay".
This new field will be selectable in the measures. Drag it into your table in the columns area and it should add a count next to your averages.
Part2:
In your measure values box you should be able to right click you measures. This will bring up a list of options including "Filter". Select this option.
On the SUM(Number of Records) set it to "At Least" = 2. Then right click on the AVG(Ratings) measure and set it to "At Most" = 3
Put Products on the Rows shelf.
Then right click on that Products field on the Rows shelf and change ITT from a dimension to a measure. Be sure to choose Count Distinct for the aggregation.
Finally, right click on the field again and change it from continuous to discrete.
This shows how many different products each person reviewed, no matter how many characteristics they rated. If you want the number of ratings, use count instead of count distinct. Or just Sum(number of records), again set to discrete