Tableau find count of dimension for each of other dimension - tableau-api

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.

Related

How to dynamically filter based on different column in tableau?

I have two columns site and Profit catgeory.
Site --> A, B, C
Profit Category --> 1,2,3 [ It will be calculated dynamically, when data changes]
Data:
I want to filter site based on profit category.
Workbook:
If I select Site A in filter option, it hsould display all the sites which is in same Profit category as Site A. If Site A falls under Profit Category 1 means all Sites wchich falls under Profit Catgeory 1 should be dispalyed.
I am struck with this. Please help me to solve this.
You need to display a parameter control instead of a filter control.
Parameters are used to hold the (single) response from the user for making a choice. You can reference parameters in many places, including calculated fields. You can then use calculated fields as a filter.
You can combine these features in different ways. In your case, I suggest creating a parameter based on the Site field. Showing the parameter control and allowing the user to select a site. Then building a boolean calculated field to determine whether a record should be included in the analysis or not based on the selected site and the data values in the current record.
Filter on that calculated field and you should be able to get the effect you described.

How do I group dates in IBM COGNOS when building a front end dashboard

I am an extreme newbie to COGNOS (5 days give or take a few hrs) and have been thrown in the deep end.
I have a data package i am working with and the only date field I can use has the property of timestamp. I have looked through other questions that are similar and i have used the "CAST" function to turn the field into a date so this has worked.
cast ( [TR_Logical Layer].[Fact Event].[Period Datetime],DATE) - so I was happy with that.
However now when I am building the graph, I am getting repeated dates - and I can only think that this is because somehow it is still holding onto the timestamp portion of the field.
Please how can i get all of my many dates for say the 21st Jul to be one?
Possible issue: Repeating is probably due to how it is grouped (down to the time which would have the day repeating)
Suggested solution: Add a determinant to control granularity and grouping
Here are the steps
https://www.ibm.com/docs/en/cognos-analytics/11.1.0?topic=determinants-specifying
Click the query subject you want, and click Actions, Edit Definition.
Click the Determinants tab.
Click Add under the Determinants box.
The entry New Determinant displays in the box. To give this entry a meaningful name, right-click it, and click Rename.
To define a key, right-click a query item in the Available items box and click Add as Key. Tip: You can also drag query items to the Key box.
To identify which query items should be associated with this determinant, right-click query items in the Available items box, and click Add as Attributes.
Tip: You can also drag query items to the Attributes box.
You can have a determinant with no attributes defined for it. Framework Manager uses this type of determinant to indicate which query items are indexed.
To specify that the selected determinant should be used as the unique identifier, select the Uniquely Identified check box.
Do this only if the data in this item is unique for every row in the underlying data source. You can specify more than one unique determinant if they are truly unique. At query time, the relationship being used will determine which unique determinant to use.
Select the Group By check box to indicate that when keys or attributes associated with that determinant are repeated in the data, IBM® Cognos® Analytics should apply aggregate functions and grouping to avoid double-counting.
If you want to change the order of the determinants, use the arrow buttons.
Determinants are processed in the order in which they are specified in the model.
Click OK

Tableau KPI prev value depending on variable

am trying to get Previous Sum(of someField) based on a variable value which is an Id.
This is not a table, Im doing a KPI
On Qlik you would do something like:
SUM({<Id={"$(=Max(vVariable),-1))"}>} someField)
But I can not achieve it on Tableau, off course is due to my lack of knowledge, unfortunatelly time is tinking at work and wanted to see if anyone has any input!
Thanks
Assuming you may use a sample input like the Superstore (using sales as metric), this could be what you're looking for:
In red you can see your "variable" which allows you to select a value and in blue you'll find the unique row for the previous value (Order ID sorted).
The first thing you need to to do is creating a parameter based on all the Order ID values:
Then things start to get a bit complicated if you're not familiar with LOD (Level of details) and the order of execution in Tableau, especially for filters.
Assuming that you can get some information on your own (otherwise, feel free to ask), the first thing you nee to to do is to "pre-calculate" the equivalent of a table having a rowe for each Order ID, in which you also have the previous Order ID value.
You can achive this combining Fixed (LOD) and Lookup function, creating this Calculated Field "Lookup Order ID":
LOOKUP( max({ FIXED [Order ID] : MAX([Order ID])}),1)
This is actually just a calculated field that you want to "fix" because you need the filter to act after you have made that previous calculus, and then you shift your data by 1 row backward.
Once you've done that, you just nee to create another calculated field in order to test your parametric value, and it could be something like this "check param":
[Lookup Order ID] = [Order ID param]
Moving this calculated field in the filter section and selecting just "true" values, you'll get that unique rows like in the initial image, showing the previous value (blue) related to the one you select in the parameter drop-down menu (red).

Graph based on the user filter selection

On a tableau dashboard there are 2 filters and a bar graph.
The filters are 1. to select top or bottom customers
2. how many ex:5,10,15 etc
when the user selects top and 5 in the respective filters then top5 customers have to show in the bar graph.
if the user selects bottom ,10 in the respective filters then bottom 10 customers have to shown in the graph.
how to achieve this when the data contains only customers details and their billing amount ?
Instead of filter, you can go with the Parameter for getting the result. I have done the top and bottom multiple times in many of the tableau visualizations and its so easy.
Below are the steps to achieve your requirement.
Create a parameter that will allow you to select top and bottom
Create another parameter that will allow you to select the desired numbers like 5, 10, 15 etc.
Here i have created a parameter that will have values from 10 to 50 in a step size of 10.
Create a calculated field that will subset data based on the parameters chosen
In the above screenshot, I am using the top site parameter and creating a conditional statement that will show the states based on the value chosen in the site parameter and the value for that state.
Put the calculated field in the filter and select show and click ok in the filter box.
Now the view will show the top count based on the value selected in the parameter.
Please note the calculation is for top N and for bottom N you need to change the calculation.
Hope this will help you. I can provide you a workbook if you need.

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