Tableau layout for multiple charts on one worksheet - tableau-api

I have 15 pie charts on one worksheet (one for each year since 2006). At the minute I can either have them in a vertical line or a horizontal line but I want to have them in 3 rows of 5, how do I go about doing that?
Thanks in advance (from a Tableau newbie) !

What you're looking for could be a tecnqique that consists in creating two additional calculated field for row_indicator and column_indicator.
So assuming you have a pie for each product_category you could create something like this for rows:
if prdocuct_category in ('a','b','c','d','e') then 1
elseif prdocuct_category in ('f','g','h','i','j') then 2
else 3
end
Once you've done the same for columns, you can use those two fields in the worksheet as first field in row/column shelf.
Otherwise, you can check the small multiple technique which is more or less the same and splits your by in groups according to the square root.
Check this tecnique in this video:
https://www.vizwiz.com/2016/03/tableau-tip-tuesday-how-to-create-small.html

Related

How to apply a filter to only one column? The columns differ by a value of the same binary filter

I have visualizations that have bar graphs set up in 6 separate sheets. These bar graphs need to go side by side for comparison. 2 graphs will be combined to form one side-by-side graph. They only differ by a filter that is set to either 0 or 1 in the corresponding sheets. Everything else is the same.
Example:
In sheet 1, XMJ is filtered by Misdemeanor = 0
In sheet 2, XMJ is filtered by Misdemeanor = 1
I'd like to make them show side-by-side for comparison.
I have already tried duplicating XMJ and bringing it side-by-side but couldn't apply Misdemeanor = 1 or 0 separately to the duplicate column.
Here is the file: Visualz
You can accomplish this with a table calc filter.
Create a calculation lookup(min([Misdemeanor]),0) and put it on your filter shelf in each sheet and you can filter them independently.
Table calcs happen after the data is displayed on the viz (see Order of Operations).
The min([Misdemeanor]) part tells Tableau you want to look at the minimum value (this could be also max/attr/sum it wouldn't matter in your case).
The lookup(measure,0) tells Tableau to look at the current row of the measure (but again, after the data is already on the table). At this point, you can filter it independently.
EDIT: Another thought is you might just have the filters set to All Using this Datasource or (multiple) selected sheets. You can change this behavior in either the worksheet (1st picture) or dashboard (2nd worksheet).

plotting multiple lines in Power BI graph

I would like to plot multiple lines on one graph, but I can't do it with simple "line chart".
I have only one dataset, and what I want to do is to use lines to represent different filters.
I included few filters which are the same for all lines, but each line will have a different filter for one column.
So, to be simple: I am using 4 filters for my dataset, and for all lines 3 filters are the same, but the lines are different because 4th filter is unique for each line (example: Column A = "1" for line A; Column A="2" for line B etc.)
Hope I could explain it well enough,
Looking forward to your answer!

A filter to apply only if only one item from two other filters are selected

I have two filters for WeekNumber and Employee (name). I also have a column that shows the SUM of hours the employee has worked. Let us call it SumHours.
What I want to do is to specify the employees who have overworked, which is
if the number of weekly hours is more than 38.
If the condition applies I'd like to highlight them by adding a background color to their row.
Adding the above filter to the entire table is not a problem. What I want to do is for this filter to appear only if (1) one week and (2) one employee have been selected. Because otherwise the calculated field will highlight the employee if they have overworked in average.
How can I create a condition in my calculated field so that a condition is checked in two different places? I have found the SIZE() function but then we should also select the option Compute Using... to assign it to a specific filter. But apparently one cannot do that to two filters.
If I understand your setup correctly, I think a level-of-detail calculation might do the trick. This is pseudo-code, you will need to adjust for your dimension names. With LOD, you are getting the value of the hours worked per employee and week, regardless of which dimensions you have in your rows or columns.
if {FIXED Employee, WeekNumber : sum(HoursWorked)} > 38 then "Highlight" end
Then add this calculated field on the color marks card.
More about level-of-detail calcs can be found in Tableau's online help.

Pick group totals, grand totals and normal summarization in Tableau

I am trying to calculate average of 2 columns in another column in Tableau but difficult part is grand total is not getting average instead it is the sum of 3rd calculated field.
A B Calculated field
10 5 2
6 3 2
T 16 8 4 (Here I should get 2 instead it is taking sum of column)
Here I am unable to write separate formula for row totals and grand totals, Only one formula (Calculated Field) is allowed and when I am dragging on sheet it is by default aggregating to sum.
Note: I am expert in Crystal and BO but beginner in Tableau.
Update
Code used for LoD
{FIXED [Product Category]: AVG([Sales])}
Below image is what I got after implementation I have tried with 2 columns but the result is same if I use only one column (I am trying to get the average of sales)
You are almost there - the Grand Total by default does a SUM function you just have use the Total All Using --> Average option.
Output : Level wise SUM(Profit) later averaged across columns and rows. (Show Column Grand Total & Show Row Grand Total active)
Update: Answering the question below. To get the Row-wise avg (which is Cat1-vag in this case) you could just drop the measure and change it to AVG(). Since you needed in a Calculated Field you could use a Simple FIXED LOD. You can also uncheck aggregated measures from Analysis dropdown and have no Dimension in column or row like unlike what this example shows and still get three different averages. Cheers.
{FIXED [Cat1]:AVG([Profit])}
Check out this very smart work around from Joe Mako.
https://community.tableau.com/thread/112791
create a calc field like:
IF FIRST()==0 THEN
WINDOW_AVG(SUM([Sales]),0,IIF(FIRST()==0,LAST(),0))
END
duplicate your Category field
place "Category (copy)" on the level of detail
set the compute using for the calc field pill to use "Category (copy)"
The window function in the calculated field only takes into account what's in the view, and aggregate based on those number.

Tableau: Plot percentage of binary column

Simplified example: column of 'measure' data is binary 0's and 1's. The sum of the column (all the 1's summed) is 3948. The length of the column is 4567. 3948 is 86% of 4567. How do I create a bar chart showing this percentage. All I can get is a bar adding up to 100%.
I've tried absolutely everything in the percentage of dropdown, calculated fields, online tutorials, etc.
Two approaches:
Right click on your measure field on whichever shelf you placed it. Choose Quick Table Calc -> Percentage of Total. Experiment with different settings for "Compute Using" and read about addressing and partitioning of table calculations to learn how to specify percent of "what".
Or create a calculated field specific to your problem defined as below:
sum(int([my measure field] = 1)) / count(1)
Be sure to set the default number format for your calculated field to a percentage, by right clicking on it in the data pane (left margin) and revising the default properties
Note, the second calculation works because the INT() function converts True to 1 and False to 0, which is useful in several contexts.
You can go about this using the following method
Add 'measure' to Columns and make it a Discrete Dimension
Add SUM(Number of Records) to Rows. This should give you the bar chart you need.
This would help achieve what you are looking to do. For more customization and a better look for the graph you are looking to build in Tableau.
Add 'measure' to the colour legend and make it a Discrete Dimension.
Add SUM(Number of Records) as a Label and do a '% of Total' quick table calculation.