Percent of Total for Categories Within Different Panes - tableau-api

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])}

Related

Showing absolute and percentage values in Tableau

I want to show both absolute and percentage value in a single view in the form of a matrix.
In the below view I am trying to add one more column showing values as percentages of total
Got hint here but not able to replicate:Tableau - Both count and Percentage in Measure Values
The data is like this
can any one please suggest!
Not that difficult. I recreated a data like yours,
Follow these steps
Add slide on rows
Add number of records in text on marks card
Add table calculation on this field -> percent of total. The view will look like this
Notice a small triangle in 'no of records' field. That indicates that it is table calculation
Add number of records field once again to text. (Tip: Double click the field number of records to add it to view directly)
Reorder as you like
or with totals

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.

Calculating % Complete

enter image description here
From the Image I need to calculate % complete for the order number 1.
Calculation for complete will be
(total number of points for status 'Delivered' / total number of points)*100
The value should be 57%
Can some one help with the calculated field?
Look at IIF in help files
SUM(IIF([Status]="Delivered",[Point],NULL)) / SUM([Point])
I assume your column named Order No. extends all the way down each row (i.e., each row should have a 1 as Order No. but the screenshot does not show that.
Also, the above only works if the status of "Delivered" is consistently cased, which it is not in the screenshot. If it is not consistently cased, wrap [Status] in an Upper function:
SUM(IIF(UPPER([Status])="DELIVERED",[Point],NULL)) / SUM([Point])
You can also get the effect you want, just by manipulating the Tableau user interface -- without needed to write calculated fields as #S. User18 showed. Both approaches work, but it helps to understand both alternatives.
As with #S. User18, I assume your column named Order No. is consistently filled in. I also assume [Order No.] is a dimension.
Place [Order No.] on a shelf, say Rows
Place [Status] on another shelf, say Columns
Place Sum([Point]) on a shelf, say Text
This shows the sum of the number of Points for each combination of the two dimensions: [Order No.] and [Status]
To convert the number of Points to a percentage, right click on Sum([Point]) on the marks card, and choose Quick Table calculation->Percent of Total
Similarly, right click on Sum([Point]) and experiment with different "Compute Using" settings to get the effect you want -- i.e. percent of each row, column, table etc. You can instead Edit the Table Calc if the preset Compute Using options don't get the effect you want.
Right click on any row or column headers that you want to hide - so if you only want to display the percentages for the Completed Status, hide the others. Don't exclude the others as that will change the calculations.
To understand more about Table Calculations, see the online help.

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

Show Separate Mark Labels alongside Measure Value Labels

(source: tableau.com)
I'm using Measure Values for combining two measures:
1)Count of Clients (As a percentage)
2)% Retention (Calculated field which uses another calculated field called Numerator Retention in it's formula over the total to calculate the %)
Measure Value Mark Labels successfully show the respective percentages for the two measures. Now I wanna show the respective count of clients or numbers behind these percentages but I'm unable to do so since I've already used Measure Value Mark Labels to do something similar.
When I try editing the Labels text, it edits it for all labels together and hence I'm getting all labels for all rows and not how I want it to show selectively as I described.
Example Solution: For Private Residence, I only want 125 to show with 60% which is the actual number behind the percentage. And I want only 119 to show with 95%
You can do this, but not using Measure Values. You should mirror what I have done here. I do not know your calculation for the Respective Retention, so use your calculation.
You need to move both of your measures to the Columns shelf and make them a Dual Axis:
After doing that, you will have access to the individual measures - so you can give labels independently:
Just make sure you place the measures that you want for each axis respectively.