Calculating percentage of survivors per cohort over time in Tableau - tableau-api

In my dataset, I have three columns of data:
CustomerID, BoxCount, MonthCreated
1001 1 Aug 2015
1001 2 Aug 2015
1001 3 Aug 2015
1002 1 Sep 2015
1002 2 Sep 2015
In the screenshot below, I have built a table that displays the count of unique CustomerIDs at each BoxCount level, by cohort (MonthCreated, which is when the customer signed up).
BoxCount level 1 is the full number of people who signed up in MonthCreated X, because everyone who has signed up receives at least 1 box. Then people start cancelling. The number of people who reached BoxCount level 2 for May 2015 (according to the screenshot), is 156,823, or 86.87% of total people who signed up in May (180,525).
I need to create a second column next to the count of customers that displays the % of customers remaining at each BoxCount level, per cohort (people who signed up in the same month).
I have tried using the Quick Table calculation Percentage of Total, with the computation method being "Table (Down)" but it only seems to work for the first month of MonthCreated. I would like for each subsequent month to have 100% for BoxCount level 1, and the following % to be a portion of the number at each month's level 1. I can't figure out why for July, the % starts at 83.89% and not 100%.
Can anyone help me figure out how to calculate this percentage and also to add it as a new column instead of replacing the column of raw counts?
Thanks!

Looks like you're almost there. Did you try changing the calculation definition by changing the values it summarizes from or the level?
Some example:
And for it to be replacing the column of raw counts, you can just add the raw counts column again in your view and you'll have both.

Related

Google Sheet - calculating attendance from moving date range

Good day folks, we have a Google Sheet with training attendance. We are meeting on weekly basis and calculate attendance from the past four months, last 36 month and historical total.
Situation: Currently, we calculate the attendance by assigning 2 (double training)/1 (normal training)/0 (canceled training) to the value of the training and attendee (2 on double, 1 on normal, 0 when absent) - and get attendance percentage by comparing the person's points sum to that of the trainings during the given period (4 months, 36 months, total).
Issue: The problem is that every time we add a training (new row in the tab), we need to manually change date range in the 4 month calculation and end date in the 36 months. I would love to automate this process that every time we add a new column, we would not have to change the date range.
Cells:
C4 = maximum points available per trainings in the last 18 months
D4 = maximum points available per trainings in the last 4 months
C5 and below = user's attendance in the past 18 months (his points generated in that timespawn/total available points*100)
D5 and below = user's attendance in the past 4 months (his points generated in that timespawn/total available points*100)
E3:3 = cells with dates when we have trainings
E4:4 = points awarded per that specific training
E5:5 and below = points gained by the member per attendance
Question: is there any way count a number of training points gained in the past 4/18 months by a specific person?
Thank you kindly
try:
=SUM(FILTER(E5:5; E$3:$3>=TODAY()-120; E$3:$3<=TODAY()))/D$4

calculation to determine average per event by year

I have a very large table of data containing cricket information. At the moment I am trying to gather the average number of runs per match for Australia (and other countries) in years 2013, 2014, and 2015. I was able to get the average runs per year into a graph and currently I have a bar chart that looks like this:
year 2013 | 2014 | 2015
total runs 1037 | 1835 | 177
but I would like one that divides that total by the number of matches per year (6, 13, and 1 respectively) and looks like this:
year 2013 | 2014 | 2015
avg runs per match 173 | 141 | 177
but I don't know how to conduct a calculation on these numbers to divide that total over the number of games played. There is a column in my set called 'MID' for Match ID. Obviously, summing the number of MID for 2013 would give me the needed number, 6.
Ideally, I would divide the total number of runs by the number of unique items in the MID column, but I do not know how to do this. If this makes any sense at all, would anyone have a simple way of doing this? I would really appreciate it, as I'm essentially experimenting with this on my own and falling way behind on my other projects.
Assuming you have a column named "Runs" and a column named "MID", then a calculation for Runs per Match would be as follows:
SUM(Runs) / COUNTD(MID)
This gives total runs divided by distinct count of Match ID.

Create subset and overall value line chart

This may sounds very simple but I am finding hard to get that. I have a data with value in one column and category in another column. i.e.,
Value Category Month
100 A Jan
300 A Feb
200 A Mar
459 B Jan
334 B Feb
765 B Mar
I am trying to use a line chart in tableau with Month on X axis and Value on Y-axis.Basically I am trying to add two lines, one for overall value for that particular month and another line for Category A alone for that particular month. Say for example the overall value for Jan as 559 and another line in same graph for category A for Jan as 100.
Though it sounds so basic, I find hard to achieve this. Should I create a calculated field for this or is there any simple method that works for this.
You'd want a dual axis probably to achieve this.
http://onlinehelp.tableau.com/current/pro/desktop/en-us/multiplemeasures_dualaxes.html
See: Dual axis chart from the same measure in Tableau
Then you can color one of the measures based upon the category. Make sure to synchronize axis.

Rank dates in Tableau

How can I rank dates on Tableau?
By customer, I have a list of codes banked (every code has an ID and an issue day) and I am interested in calculating the number of days between the first banked code and (as exemple) the 10th code (the difference will be calculated on the issue days).
Some people may have 1 code, some 2, some 10, some 100, etc. I'm only interested in calculating this metric when the number of codes banked is > 9.
The result will be, by customer, Code 10 Issue Date - Code 1 Issue Date.
So I expect that most engaged customers will bank 10 codes in 10 days, less engaged customers will bank 10 in more days.
EDIT: added below an example of the data source (first three columns) and the missing fields to be calculated (last two columns)

Cumulative Days in Overlapping Date Ranges

I use Crystal Reports 11.
What I'd like to do is get a count of the unique days a student was enrolled in one of our many programs. If a student was enrolled in 3 programs in which the dates overlapped, I'd just want to count each day once and get a number.
Example using a student:
Algebra Jan 1 to Jan 10: 10 days
Science Jan 4 to Jan 11: 8 days
English Jan 9 to Jan 13: 4 days
I'd want the answer to be 13.
Good point. If they always over lap then this will work
Create a formula that finds maximum end date and the minimum start date based on patient. Then minus each formula.
i.e.: Maximum({xxx.enddate}, {xxx.patient}) - Minimum({xxx.startdate}, {xxx.patient})
If there are gaps between program dates, this won't work because it will include them.
Grouping the field by the patient name and Using
DistinctCount()
may be helpful.