How to make a 100% Stacked Chart with 2 measures in Tableau? - tableau-api

I am using Tableau to create a productivity progress bar of actual work done, versus the goal for that day. I have gone through numerous resources, but none seem to apply to only using 2 measures, basically putting the actual data measure turned into a percent within the goal measure. I have the chart working by using a calculated field of Missed Goal ([Goal]-[Actual]) but I am wanting into to look like a 100% stacked chart. Here is a picture of what I have, I just can't seem to get the last step expanding the bars horizontally to be a %100 chart:
Currently looks like:
Wanting it to look like:
Thank you for any help!

This is a good candidate for a few LOD Calculated Fields.
I will give an example based on the SuperStore dataset where [Profit] is a percentage of [Sales]. This can be extrapolated to your use case.
Because you have two dimensions on the view, both will be needed to be accounted for in the LOD calculations below:
//LOD Sales
{Fixed [Segment], Year([Ship Date]): SUM([Sales])} / {Fixed [Segment], Year([Ship Date]): SUM([Sales])}
We will always want [LOD Sales] to equal 1 for bar-chart display purposes.
//LOD Profit
{fixed [Segment], Year([Ship Date]): SUM([Profit])} / {Fixed [Segment], Year([Ship Date]): SUM([Sales])}
This will create the percentage of [Profit] to [Sales].
From there, you'll want to turn off Stack Marks so the bars overlap eachother:
Analysis Menu > Stack Marks > Off
And probably change the axis display to a percentage:
Right click [Measure Values] > Default Properties > Number Format > Percentage
For simplicity, your existing filters should be placed 'On Context' as to not interfere with the LODs. (Please read above linked article for reasoning and alternatives.)
Right click on Filtered Field > Add to Context
The end result should look like this:

Related

Birt Reports - Adding percentages to chart legend

Is it possible to add percentages to the chart legend, or is it the only way to put percentages to the chart, by adding the "Percentile Value Data"?
Thanks for your help in advance.
AFAIK the percentile value is usually something different, it only makes sense if the categories are based on intervals, e.g. given 7 billion living humans and measuring their age, the top 0.1 percentile are the 7_000_000_000 * 0.1/100 = 7_000_000 oldest living humans.
So, percentile values make sense for things you can measure, like age, income, length - in other words, numbers, or at least things which can be ordered.
You wouldn't use a pie chart then.
Percentile values don't make sense for things that cannot be measured like car labels.
Take a look at https://forums.opentext.com/forums/developer/discussion/48914/how-to-create-pie-chart-with-percentage-instead-of-values
M Williams writes there (I just repeat this here):
In the chart editor, you can go to the "format data" tab, then to the value series section, click on the "labels" button at the bottom, delete the "value data" option from the values window, then from the dropdown below the window, choose the percentage option and add it. This will show your pie chart labels in percentage.

creating a tableau pie chart with no measures data

I have a table (as seen in link below), that has a system assessment that we conduct every year. The assessment is a series of 4 questions (or as we call them 'attributes') and there is only 3 possible outcomes.
Table
Using Tableau, I'd like to have the system as a filter (easy to do), and for each attribute build a pie chart. There are no measures that I capturing.
Any thoughts on how to do this?
Thanks.
Once you get to know the power of LOD calculations in Tableau it is not that tough. Walkthrough-
Step-1 Create LOD calculated field for each Attribute as, Attri_1_Measure
{Fixed [Status of Attribute 1] : COUNT (sheet_name)}
Step-2 Add Attri_1_Measure to angle, size and text measures, Status_of_attri1 to text and color. You'll get your desired view.
Step-3 Add System to filters, right click and add filters to context (very important step).
You can repeat these steps for each attribute.
Note: Beginning version 2020 of tableau there is no measure as number of records, but there is a sheet/data_table count measure therein. Good Luck.
Aliter: Easy solution:
Click on/select number_of_records/count(sheet) and also 'attribute_1field in data pane and clickpie_chartonshow_me` (ctrl +1) tool of tableau and pie chart will be created.

How to make a stacked bar chart where the total measure is always fixed at 100%?

I am attempting to create a 100% stacked bar chart in Tableau where the total stacked measure is always equal to 100% on the axis in order to make a productivity dashboard. I want all filter options to look like the first picture attached below where the total stretches and stops at 100%. However, some cases break this rule, such as going over 100% or when the "All" option is selected and stretches it 700%.
I tried fixing the axis max at 100% and it works perfectly for all the individual employees but since the "All" selection goes up to 700%, it just shows it all the way full at 100%. Is there anyway to make my total measure, in this case "Goal", always set to 100% no matter what the number is? This is my current formula for my total measure of "Goal" {Fixed [Contractor], Date: SUM([Goal])} / {Fixed [Contractor], [Date]: SUM([Goal])}
Thank you for any help!
Employee 1 with normal productivity where the axis is staying at 100%.
Employee 2 going over 100% where the axis then stretches past 100%.
All employees added up where it stretches the axis to over 700%.
This is most likely a problem with the "Compute Using" attributes for the table calculation. Since table calculations are secondary calculations on top of your existing measures you have the flexibility for how they are calculated.
Here is how to adjust this. Click on your measure and select "Edit Table Calculation..."
To get the same result as you I will want the table calculation to calculate on "Table (across)" which will look at the dimension (in my picture, Category) instead of by Category AND Month. The little numbers in brackets and the yellow highlights are especially helpful in showing you how the calculations are being interpreted.
See the default "Table (down)" and the desired "Table (across)" calculations in the screenshot below. You will likely want the same but it might depend on your exact Viz setup.

Tableau: Output grouped data in different graphs

I have a data set (let's assume it's students and scores) in Tableau.
I have used the Rank_parcentile() to rank them:
Rank_parcentile(sum([score]))
I then use the following code to group the students:
IF [percentile] > 0.8
THEN "Top 20%"
ELSEIF [percentile] <0.8 and [percentile]>0.5
THEN "Mid 30%"
ELSEIF [percentile]<-0.5 THEN "Bottom 50%"
This works very well and groups them as so. The problem is that sometimes I have too many students and they can't fit in a single graph reasonably.
Is there a way to divide the top 20% in one graph , the mid 30% in another and the bottom 50% in another?
Thanks in advance :-)
An easy approach is put percentile on the filter shelf. Show the filter, and then interactively switch between the three groups of marks -- all on the same chart
Alternatively, you can use a similar calculation to make a trellis chart.

How do I display the total percentage and count together as a stacked bar chart without formatting all data to percentage values?

I asked this question (and this question) recently, and even though both have solutions, I am left with a new dilemma because each solution only works on an independent level (i.e. one solution won't work if the other solution is in place).
The problem is this: In Tableau, I discovered that by opting to display the data as a percentage of the total row value Analysis > Percentage of > Row, it resulted in the count value also being displayed as a number between 0 and 1 (i.e. percentage format, because of the aforementioned percentage-only setting).
Is there a way to achieve a 100.00% stacked bar which shows both percentage AND count, and which also isn't formatted to display all data as a percentage of the row total?
The screenshot shows what happens when both solutions are in place. Original screenshots are available within the body of each of the previous questions.
Note: I feel that the right way to go about it might be to normalise my data (bringing all values to a scale between 0 and 1), but being new to Tableau, I am not sure how this is achieved. If this is correct, I would appreciate a walkthrough.
Right click on the second SUM({Number of Records]) pill on the Label shelf, and clear the table calc. Edit your label if needed