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

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.

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.

Percent of Total for Categories Within Different Panes

I'm attempting to calculate the percent of total based off the the first column in each pane. However, table calculations only allow a calculation based off the each pane
SUM({ FIXED [Category]:SUM([Number of Records])})/TOTAL(SUM([Number of Records]))
does not produce the desired result.
It simply measures the number of records total in the category.
I cannot fixed the TOTAL function to category as it is a table calculation.
In the image, essentially I am trying to get all of the bars of the same color together without adjusting their heights.
enter image description here
I'm not really sure on what you're trying to do, when you say "percent of total based off the the first column in each pane" - does that mean total records with category 'furniture' & region 'central' shown as a percentage of all records, or total records with category 'furniture' shown as a percentage of all records with region 'central'? Or something else?
I have a feeling you can get to what you need by creating 2 fixed LOD calculations, or by fixing to 2 dimensions (e.g. { FIXED [Category],[Region]:SUM([Number of Records])}

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

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:

increase gap between bars in multi category groups

current imageI want to increase gap between bars in my SSRS bar chart after every group is finished (e.g. after every month). I have 2 category groups month and level. in each month there are 3 levels and I want to increase gap after 3 columns.
can you please help me?increase gap
There does not appear to be a way to increase the gap. However, there are two 'solutions'.
1. Go to the Chart Series Properties -> General -> Custom Attributes, and reduce the point width, perhaps from 0.8 to 0.6. Have a little play until you find something you like.
2. SSRS: Custom bar width between multi-level categories Try something like this. Add a dummy group to your dataset that has no value and turn the labels off.
I would go for number 1 as it is much simpler.

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