Tableau how to show labels for both total and running total - tableau-api

I am new to Tableau, in my simple example below
It shows sales by year and quarter, and also a running total for each year. I know how to create running total. My question is how to create the labels (Sales Total, Running Total)?
The example is from here: It's a simple illustration without step by step guide.
http://onlinehelp.tableau.com/current/pro/online/windows/en-us/help.htm#calculations_tablecalculations_definebasic_runningtotal.html%3FTocPath%3DAdvanced%2520Analysis%7CCalculations%7CTable%2520Calculations%7CDefining%2520Basic%2520Table%2520Calculations%7C_____6
I tried to add Measure Names to Rows and only got this. The label displays 'No Measure value'. But if I add Measure Values to Marks, it shows all measures with labels but not the running total.

The problem is that you have your measures on the text shelf, instead of measure values. So Measure Names shows "No Measure Value".
First step, try to reproduce the following:
Then you can provide an alias for each measure name (such as by right clicking on the long names and choosing "Edit Alias") to make the measure names more readable like:

Related

Tableau Percent Difference Between Week

I am trying to display a graph that shows the increase or decrease in percentage of calls from each country over time (sample data and desired output below). This is intended to answer the question, "Has the proportion of calls within the USA compared to the others gone up or down in the past week?", not to be confused with answering the question if USA has just seen more calls.
In the example below, I am looking for a bar chart that shows increases/decreases for all of the countries (x-axis = country, y-axis = percent difference)
I understand how to do this based on a simple change in count, but am struggling to look at this as percent of the total.
Sounds like you want to do a Table Calc on a table calc. No problems to do this. I suggest creating the first calculated field and saving it as a new calculation. Then use that field within your final table calculation.
If you're creating the table calculation using the Quick Table Calculation, double click in the pill to see the underlying formula - you can copy this out and paste into a new calculated field.
You are also able to set the "Compute Using" separately using this method, which may be useful in this example.

How do I sort this scatter plot?

I would like to sort this scatter plot, which is summarized with a Band that includes Minimum, Average, and Maximum.
I would like to sort it in 2 ways:
by Average
by Widest Range (ie difference between Minimum and Maximum values)
Tableau Public workbook
If you can't view this or I'm not allowed to post external resources on stackoverflow, then perhaps you can show me on this screenshot what I would click to get started on the following sort
Also, bonus question, is there a way to create a control for the user to toggle between the 2 sort methods in the same chart? Or do I have to duplicate the chart with a different sort type for each?
One note is that I only have Tableau Public version since I'm evaluating the product. Until I get a paid version, I can't open a workbook file unless you publish it to Tableau Public cloud. But rather than give me the workbook answer, I would just appreciate it if you gave me instructions to do this as this is more of a learning exercise.
Thanks!
Somewhat unfortunately, you'll have to replicate the min,avg,max by creating 3 calculated fields. Tableau cannot operate on the values placed on the view via reference lines.
These calculations might look something like these:
{Fixed [Cwe]: Min([Cvss Score])}
~
{Fixed [Cwe]: Avg([Cvss Score])}
~
{Fixed [Cwe]: Max([Cvss Score])}
In general, from there, you should pretty easily be able to apply them to the view and sort. Average will be easy. The difference between Min and Max will just need a subtracting calculated field to sort by. Once they're on the view, I'd put them as a dimension (column) to verify that the numbers look correct.
Take note that LOD calculations take place before filtering, so you'll want to put the Cvss filter you have there 'on context' by right clicking it and clicking 'add to context'
Here is how I would complete the sorts:
Starting with all the above calculations on 'Rows' and ensuring that they are 'Dimensions' (Blue).
After right clicking "Sort..." on [Sub-Category] on 'Rows'. Select which field to sort by.
From there, the calculated fields can be taken off the rows column. (They were only there in the first place to ensure that you could check that the sorts took place. They don't actually need to have been there in the first place.)

Side-by-side bar chart: One with the current filtered selection and one for total

I calculate the percent of total number of active customers for each SalesOwner in one of my Workbook sheets:
As you see, I have also added the SalesOwner as a filter.
The calculated field (segment_active_members) is computed using the following formula:
COUNTD(wk_customer)/ SUM({FIXED : COUNTD([wk_customer])})
What I want to do is create a side-by-side bar chart where upon filtering one of SalesOwners, I am able to compare it with the total (100%). So if I filter the above sheet by SalesOwner X which takes 5% of total. I'd like to see only two bars with one having 5% of the other one's length.
So I add another calculated filed to the above scenario where a fixed total is calculated:
SUM({FIXED : COUNTD([wk_customer])}
We will have a new column in the above picture with a fixed value of 100% for all rows.
I get what I want when my filter is on "All".
But as soon as I select a single filter (SalesOwner), my first percentage is also changed into 100% and I can never compare it to total.
How can I show the percentage against total for single segments?
This could be one of the solution:
Change the calculation of segment_active_members as follows
SUM({FIXED [Sales Owner]: COUNTD([wk_customer])})/SUM({COUNTD([wk_customer])})
Remove the table calculation for segment_active_members in the Measure Values shelf
You'll see that you are able to filter it down without any problem now
Cheers!

Tableau average line on chart of averages

I have a bar plot with average values for some dimensions, let's say: weekdays. Now I want to put an average line on it - I use Analytics > Average Line. The line I get doesn't show the average for all data examples though, but the average counted from the aggregated values on the plot (avg from 7 values).
Can I get somehow the other one?
Put whatever your [Value] field is called on the Detail shelf. Then double click on it to edit it on the shelf
Change the expression to Total(Avg([Value])) where Value is the field you are displaying
Use this field for your average line, Read about Total() in the documentation. You may also need to edit the table calc addressing and partitioning characteristics to scope your total as desired (although the default settings often work) Read about Table Calcs in the on-line help for more info

Adding Reference Line for Weighted Average in Tableau

I've got a bar chart with three months worth of data. Each column in the chart is one month's data showing the percentage of Rows that met a certain criterion for that month. In the first month, 100% of 2 rows meet the measure. In the second month, 24.2% of 641 rows meet the measure. In the 3rd month, 28.3% of 1004 rows meet the measure. My reference line which is supposed to show the average across the entire time-frame is showing 50.8%, the simple average (i.e. [100+24.2+28.3]/3) instead of the weighted average (i.e. [100*2+641*24.2+1004*28.3]/[2+641+1004]).
In the rows shelf, I have a measure called "% that meet the criterion", this is defined as SUM([Criterion])/SUM([NUMBER OF RECORDS])
The criterion measure is 1 for any record that qualifies and null for any that do not qualify.
If I go to Analysis >> Totals >> Show Row Grand Totals, a 4th bar is added, and that bar shows the correct weighted average of the other three bars (26.8%), but I really want this to be shown as a reference line instead of having an extra bar on the chart. (Adding the Grand Total bar also drops the reference line down to 44.8%, which is the simple average of the 4 bars now shown on the chart--I can't think of a less useful piece of information than that).
How can I add the weighted average as a reference line?
Instead of using 'Average' as your aggregation, try using 'Total' instead in the Edit Reference Line dialogue window.
I have to say it's a bit counter-intuitive, but this is what the Tableau online help has to say about it:
http://onlinehelp.tableau.com/current/pro/online/mac/en-us/reflines_addlines.html
Total - places a line at the aggregate of all the values in either the cell, pane, or the entire view. This option is particularly useful when computing a weighted average rather than an average of averages. It is also useful when working with a calculation with a custom aggregation. The total is computed using the underlying data and behaves the same as selecting one of the totals option the Analysis menu.
If you are using Tableau 9, you can make second calculated field using an LOD expression
{ SUM([Criterion]) / SUM([NUMBER OF RECORDS]) }
This will calculate the ratio for the entire data set after applying context and data source filters, without partitioning the data by any of the other dimensions in your view (such as month in your case)
If you place that new field on the detail shelf then you can use it to create a reference line.
There are other ways to generate a weighted average, but this is probably the simplest in your case.