I have below data
Name Product
XYZ A
XYZ B
XYZ A
MAP Z
MAP Z
I want only those customers that have more than 2 distinct products. So in the above example, we get only XYZ, so the count is 1.
Not sure how to do it.
Thanks,
Hema
If you only want to see the customers without information on the different products, you can drag the Name pill to rows, create a calculated field distinct_products as
COUNTD([Product])
and drag it to filter. Select 'at least' and enter '2'.
If you still want to see the product information you can solve this using Level of Detail expressions in Tableau together with a filter.
Create a new calculated field distinct_products as follows:
{exclude [Product]: COUNTD([Product])}
Drag this to filters and choose attribute. Then select 'At Least' and enter '2' as value. Now the filter is in place. What you then need is to drag the 'Name' pill to rows.
If you want the products to be shown in a single row: drag the Product pill to 'Text'. If you want the products to appear in multiple rows, drag it to rows.
Related
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.
I want to add rows to a Tableau text table without making the row a subset of the previous row. Using the example below, I want values for teams and status to display on separate rows rather than status appearing as a subset of team. I also want to add a team filter so that if I filter on team blue, values for green row are zero and status values update . Is this possible? I tried creating separate worksheets but keeping things aligned is problematic.
Example Data:
Desired text table:
What I don't want:
Select both the fields(team, status) simultaneously then right click and go to Transform > Pivot.
Then 2 Dimensions will be created. Drag the Pivot Field Values on to Rows section
and Year on to Columns section and keep Year in Discrete format.
Then drag Number of Records on to value field section.
Before Pivot:
After Pivot and final viz:
I have a Tableau file whose source is from one Excel sheet as shown below:
And it's how it looks in Tableau:
I have a Tableau sheet to show me the top 3 customers in each section. For example, company F, H, J, B, A are in section XXX, I filter section XXX only, sort F, H, J, B, A, select the top 3 customers and hit "keep only". So I have a table of top 3 customers in XXX section. Please see the pics below:
My question is, every month I have an updated Excel sheet with same format and I feed it into Tableau, the sales change every month but I always want top 3 customers in each section. For example, top 3 customers this month in XXX section are F, H, J but next month it might be A,B,H. However since I use "keep only" to filter F, H, J, the top 3 customers can only be F, H, J unless I manually change the filter. Is there anyway I can program Tableau to pick up the top 3 automatically whenever I feed new data to this file? I know "filter top n by" can do it but it can only filter by one variable, like they can only filter by sales instead of sales AND sections. I want to use "by formula" in the pic below to do it but I am not sure how to write the formula.
Have you tried to use the "Top" instead of "Condition" tab? You could also try to use a rank.
Create a calculated field "Rank", put index() into it, make it discrete and put it between your segment and customer pillow. Untick "Show header" and use it as a filter on the filter shelf.
I would use the Quick Table Calculation Rank. To do this create a new worksheet as follows:
Drag Section onto Rows
Drag Customer onto Rows
Drag Sales onto text mark
Drag sales onto detail
Right click the sales that you have dragged onto detail. Select Quick table calc and then rank.
Change this table calc from the detail mark onto the rank mark.
Now you can see what it is doing my default. You can see that is will be calculating the rank across all sections. As you mentioned you want the rank per section you just need to adjust the way the quick table calc is working. To do this right click on the measure and select edit table calc. Under Compute using you can change the way the calc is working. Select a couple of different ones to see what is happening. As you have structured the workbook to have Section and then Customer on the Rows shelf you should be able to use pane across then down. This means that it will calculate the rank per pane which in this case is per Section and will calculate down across Customer.
8) You can now drag this measure onto the filters pane and select a range of 1-3 this will filter the view to only show the top 3.
This method will work dynamically even when the data is updated :)
I am trying to create a calculated field like the below.
but it gives me an error on aggregate and non aggregate values.
Can someone help?
if (COUNTD([Category])=1 then [Sub-Category]
else [Category] END
Note: I am using the super store data. So when a user selects a filter
in the quick filter for category, I was hoping that the countd becomes
one and shows sub category as rows in the table instead of category.
You could use a sheet selector approach to get this effect. The idea is to create a calculated field that outputs a column to be used a the filter to select the sheet.
First create a calculated field as follows:
{ FIXED : if COUNTD([Category]) = 1 then 'Sub Category' elseif
countd([Category]) > 1 then 'Category' END}
Now create two worksheets one broken down by category and the other
my sub category.
Add your Category filter to both worksheets and set to a context
filter.
Drag your calculated field column onto the filter pane as well. For the Category worksheet select the filter to Category and vice versa for the sub category worksheet. Hint you can manually add the value or edit your category filter to show the relevant value for each worksheet
Drag both worksheets into a dashboard and format so the worksheets behave appropriately https://community.tableau.com/thread/132957
Tada! A dashboard where the axis will change depending on what you have selected.
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.