Create subset and overall value line chart - tableau-api

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.

Related

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.

How to change the range values in Qliksens

I am practicing on how to use Qliksense and I came across this problem. I want to change the range values for the y-axis to show the difference in the Number of Sales between Year 2016 and Year 2017, which have values 105004 and 105609 respectively. However, as the values are too close to each other, I have been trying to find out how to change the values for the y-axis so that the graph will be able to show the difference in the Number of Sales between Year 2016 and Year 2017 more clearly. The picture below shows the graph of the no. of sales between Year 2016 and Year 2017. Please kindly advice on how to change the range values.
You can change the Min value to reduce the range
The max value you can increase a bit for better formatting.
This will give you a better perception of the variation
changing the min and max
barplot

Tableau: graphically show compounded leadtimes

I have a chart that shows the number of departures for a given 15 minute interval as seen here.
I need to compound these counts backwards for one hour. For example, the 3 departures shown at 11:00 need to also be represented at the 10:00, 10:15, 10:30, and 10:45 columns. When completed, the 10:00 would have a total of 6 departures (10:15 -> 6, 10:30 ->5, 10:45 -> 4, 11:00 -> 4).
I have done this via VBA in excell, but am now needing to replicate the chart in Tableau and have been beating my head in for about two weeks now. I'd love to hear any and all suggestions.
You can use a Cartesian join against a large enough date range of your choosing to in effect resample your data and add the additional time intervals you desire.
For example, if you have a month's worth of data (min date -> max date = 30 days), then you have (30 * 24 * 4) 2880 15 minute intervals.
Create all those intervals in a separate data sheet
Add a bogus column with value of link for all rows
Create the same bogus in your actual data source
Join the two sheets together on the link column
Create a calculated field that is something along the following:
[Interval] <= [Flight Time] AND [Interval] >= DATEADD('hour',-1,[Flight Time])
This calculated field will evaluate to TRUE when the interval time is within one hour before the flight time. You can then drag this field onto your filter shelf and select TRUE value only. Effectively your [Interval] field becomes your new date field.
I would recommend adding that filter to the context and applying across the entire datasource. Before you add this filter you'll have 2880 times the about of data so be sure to do a live view first. Be careful with extracts using Cartesian joins as you could potentially be extracting more than you bargained for.
See the following links for different techniques on how to do this and re-sampling dates in general in tableau.
https://community.tableau.com/thread/151387
Depending on the size of your data (and if a live view is not necessary) it is often times easier and more efficient to do this type of pre-processing outside of tableau in SQL or something like python's pandas library.
Here is another solution provided from the Tableau Cumunity Forum. I have not tried tyvich's solution yet, but I know this one got me where I needed. Please follow the link to see the solution using moving table calculations.
https://community.tableau.com/thread/251154

Calculating percentage of survivors per cohort over time in Tableau

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.

how to freeze values of column in Tableau

I want to create a scattered plot of users usage across Month.
whenever I filter users only relevant values appear i.e if user A has used a report in Jan Feb mar and Sept only those values appear on columns tab.
I want all the months displayed on the column and then a scatter plot on it(row being Number of Records)
Try going to Analysis/Table Layout and selecting Show Empty Columns.
Note: If you're using a secondary data source, this functionality is disabled.