I want output which consists of the count of familycode and output should be like below
so baically i need three category first will be single and multiple only ASK product count . 2nd will be Single ASK and single NON ask count and third one WIth only SIngle ASK ..... and ignore the other - categroy such as multiple NON ASK and ASK and NON ASK mIX.
Related
I have a data set of users and the applications they used. For each application, I want to compute the total number of users who used only this application, who used this application + another application, +2 other applications,... At the end I need to get a treemap with where each square represents the total number of users who used only the application, the application + 1 application, + 2 applications,......and also compute the overlap percentage, that is how many users used only this application vs how many users used this application with another application. I could compute these metrics if I don't add the application constraint, that is compute the number of users who used one application, 2 applications, 3 applications, ..... and the overlap percentage was the percentage of users who used more than one application.
To do so,
I created a calculated field to count the total number of applications per user
Then I used this field to create bins, which gave me the total number of users who used 1 app, 2 apps, ..... N apps
I then ended up creating a treemap with those bins where the size of each square is the countD(users).
How to do the same but instead of only having (All) applications, be able to do it with only one application and their companion applications. I need an application selector, where each time I change the application, the treemap changes.
As you have not given sample data, I am proposing a solution assuming -
No rows are duplicate i.e. every user is associated with any unique application not more than once.
application types may not vary more than 15-20 (in that situation the solution may not work given the calculation range of tableau)
I have taken a sample data as follows-
Step-1 Create calculated field (CF) named as CF as -
// map every application with a number
CASE [Apl id]
WHEN 'apl1' THEN 1
WHEN 'apl2' THEN 2
WHEN 'apl3' THEN 3
WHEN 'apl4' THEN 4
WHEN 'apl5' THEN 5
END
You may add as many values as you have (all unique values of apl)
Step-2 add another CF CF1 as
// binary representation of each application used
{FIXED [User id]: sum(10^([CF]-1))}
Step-3 Create a parameter as
Step-4 add another CF CF2 as
// checking which user uses selected application mandatorily
If
LEFT(RIGHT(RIGHT('00000'+STR([CF1]),5), [Parameter 1]),1) = '1'
then 'Y' else 'N' end
Now you may build your view as shown below
Selecting parameter value will filter out those records where user is at least associated with selected value. Distinct count value will give you count of total applications used by these users. Now you can proceed to build your treemap. Please tell if any other help/explanation in the solution is required.
Note-1. This solution is proposed on binary logic (and hence the restriction). If you will see sum(CF1) values will give you a binary representation of applications used by that user where rightmost placeholder denotes that user is using apl1 yes (1) or not (0); and similarly onwards right to left.
Note-2: While calculating CF2 I have padded the CF1 values with leading zeros at most 5. This you have to change according to total count of your applications.
I'm having some texts and for each text I'm having some tokens attached to it in a single column. The data looks like
Text_ID, Token
1, energy
1, debit
1, flat
2, energy
2, house
3, energy
3, debit
I created a metric according to countd(Text_ID) to count the numbers of distinct texts/text_ids. Now putting everything in the obvious way on a worksheet and selecting/filtering some tokens gives me essentially a union.
I'd like to select energy and debit and get the proper count 2 instead of 3 here. Of course I'm having a lot of tokens, hence the approach described here is not scalable.
Any suggestions on how to proceed here?
I'd assume that I need to create two parameters here, but I don't know how to use them to filter properly.
It seems like you want to identify the Text Ids that have at least one data row containing one specified token, “energy” in your example, and also have at least one data row containing another specified token, “debt” in your example. If that is the problem then I’d suggest using a set as follows.
Define two parameters to allow users to specify their tokens of interest, called for instance, token_1 and token_2
Define a set based on the Text Id field called Selected_Texts using the condition MAX([Token] = token_1) and MAX([Token] = token_2)
You can use the set in many different ways. If you want to count the number of distinct text ids that are in the set, create a calculated field called Selected_Text_Id as if [Selected_Texts] then [Text_ID] end Which holds the text id for matching texts and is null for others. Then you can plot COUNTD([Selected_Text_Id]) to answer your original question.
Create 2 paramter fields for selecting the required values and create a formula and add below code:
{ FIXED [Text ID]:
SUM(IF [Token] = [Parameter 1]
or [Token] = [Parameter 2]
THEN 1
ELSE 0
END)}
How can I extract the IN count portion of a Tableau set? I can see the IN/OUT counts when I drop the set into Text but can't figure out how to get at the IN value by itself.
Ultimately, I want to create a Pie Chart of three sets with just the IN counts as the measures.
I am using Tableau Public if that is a factor.
You have to be a little careful about specifying what you wish to count.
One way to think of a set is as a Boolean function that gives a value to each data record denoting whether that record is associated with the set.
Another way to think of a set is as a mathematical set whose members are a subset of the values for some discrete field. (Or Tuple of fields)
The difference between the two views is really just a mindset, whether you consider the set as a Boolean function whose domain is a data row in the data source, or whose domain is the field on which the set definition is based.
Say you are looking at Tableau’s Superstore data set where each data record is a line item for a product attached to an order.
If your set is based on the field Region, say its called [My Favorite Regions] and currently contains {“East”, “Central”} do you want your count to be 2 (i.e. the number of regions in the set) ? Or do you want your count to be in the tens of thousands (i.e the number of line items on orders from the regions in the set)? Or something in between, maybe the number of distinct orders (i.e. order ids) within the selected regions...
If you want to count data rows that are associated with the set, you can simply filter by the set and calculate SUM([Number of Records[). If you want to count the regions in the set even though the level of detail of the data is at the order line item level,then you’ll have to use either a COUNTD to count the distinct regions, or some approach to specify what it is you want Tableau to count.
For example, put your set on the filter shelf, and show COUNTD(Region) which could be slow for very large data sets. To get the same effect without an explicit filter, you can define a LOD calculation such as:
{ COUNTD(if [My Favorite Regions] then [Region] end) }
Or you could use a table calc with the SIZE() function to do the calculation in the Tableau client instead of by the data source.
Not sure what your data looks like but you could set a certain condition when creating a set or split the IN/OUT into two different sets.
Here's a link to sets in Tableau.
You can do this with an if statement
IF [set] = TRUE THEN 1 ELSE 0 END
Then I suppose you could sum this calculated field
The most common usage is when you have a lot of categories and want to create an 'Other' category based on the categories that aren't in a set, if the set is a "Top N Set"
To do this:
IF [set] = TRUE THEN [dimension] ELSE 'Others' END
Hard to think of a good title for this.
I have a table with Agents and Referrals. The data shows in subsummary parts which are sorted by Agent.
It's easy to get a count when Agent = Referral.
However, is it possible to get a count of Referrals over the whole found set when sorted by Agent?
For example, Smith was the Agent for 10 records.
Smith was also the Referral for 8 records, 3 where Smith was the Agent and 5 where Jones was the agent.
On the subsummary part, sorted by Agent, I can get the 3 for when Smith is the Agent and Referral. How can I put on that same part that Smith is the Refferal for 8 records in the found set?
I was thinking of maybe Execute SQL but I don't know enough SQL to write a meaningful statement. Or should I go with that?
Thanks!
I'm not 100% clear on how you have this set up, but I'm going to assume you are only dealing with the two tables you mentioned -- Referrals, and Agents -- and that your report is based on the Referrals table, which has two relevant fields: Referrer, and Agent.
The first thing to realize is that, if you are trying to report on a found set of Referrals, subsummarized by Agent, you cannot have a Referral record show up in Smith's subsummary AND Jones' subsummary ... it is either/or.
I can think of a few ways to produce the report you are looking for:
Instead of reporting on the entire found set, report on smaller found sets (by person), and then assemble your report by appending each individual found set report to each other. For example: create a script that would find all Referrals with Smith as either the agent or the referrer, and that will give you a found set (and count) of 18 (from your example); iterate through all agents, and assemble the report from the collected data.
Create a new child table of the Referral table, with records for each instance of a Referral's referrer, as well as each instance of a Referral's agent (but only when different from the referrer) ... then, report from that table instead.
As you suggest, this sounds like it can be done using the ExecuteSQL command. I don't know what kind of output you are looking for, and your field names will be different (I used "AgentName", "agent", and "referrer"), but it would be something like:
Go To Layout [ "Agents" ]
Show All
Go To Record/Request [ First ]
Loop
Set Variable [ $ThisAgent ; AgentName & " referrals: " & Evaluate ( ExecuteSQL ( "SELECT 1 FROM Referrals WHERE ( agent LIKE 'SMITH' OR referrer LIKE 'SMITH')" ; "" ; "+" ) ) ]
Set Variable [ $ReportText ; List ( $ReportText ; $ThisAgent ) ]
Go To Record/Request [ Exit after last, Next ]
End Loop
set Variable [ $$MergeVariableForReportDisplay ; $ReportText ]
I have a report that I've written and I understand how to create running totals and such, but need help creating a custom evaluation formula.
I have two levels of groups, first group is based upon a certain user, the next group is based upon transactions that user has been involved in. I have details hidden, and am only interested in the totals for a particular activity. This is working great, and totals are working properly but the problem is, each activity has a 'line number', which essentially can be the same as another activity (ie: two activities can have lines 1, 2, 3 contained within), so doing a distinctive total based upon a set of data isn't accurate because I only want it to be distinct based upon each individual recordset, and not globally.
The example is below... if I do a count on each record for this dataset, it comes out to 18 because there are duplicate line numbers on each... but if I do distinct, it only comes to 9 because of duplicate line numbers across multiple actives.
I guess what I need to know is how I can take the totals per detail group, and have them total up in my second footer properly. I assume it's going to take me compiling together a string including the activity number and line number, and then comparing them?
Here is an example of the data contained within the total groupings:
I figured this out on my own... turned out it was pretty simple. I converted my numeric values to text, and included a copy of the transaction id and the line id as my test value, and did distinct on that... Sometimes it just helps not staring the problem down.