Tableau - KPI (Forms) using different variables - forms

Im trying to perform a KPI on Tableau based on the rank of certain variables such as sales and profit as the excel example below
KPI = If the country position (using rank formula on Tableau) is on TOP 3 = GREEN; TOP 5 = YELOW; OTHER = RED. As the second table shows
On Tableau, I would have to create 2 calculated field KPI_SALES & KPI_PROFIT following the logic above
The ideia is to use the forms with the 2 calculated fields created above, however, the problem it that Tableau only allows to use one variable on forms which is my problem, i will have to use 2 variables on this example
There is any other way to accomplish it?

Yes, you can do this. Go to each sheet and click on the Label Card in the Marks Shelf. Then click the box that says "Allow labels to overlap other marks". See picture.

I have solved the problem by creating fake columns such as sum(0)
so each card would allowed by the chose different variables to put on marks as the picture below shows

Related

Tableau | Display different sheets by selecting option(s) from one particular filter

Is there a way to display different sheets by clicking/selecting values/options from one particular filter?
for example, if I have this filter:
and I need to display a sheet named Departments when I select Commercial from the filter shown in the PtrScn.
However, When I click/select any other options like HR, Information ...etc, I want it to display the associated sheet with the filter "Filter by Sector"
Any hints would be highly appreciated!
NOTE: I use tableau 2019.1 and it does not show "Change Parameter" that might be needed to approach this as I noticed when I have been researching for two days now!
You should use a container (say vertical) where you wanna put your N worksheets one on top of the other one without changing vertical spacing: just let Tableau do its stuff!
Be sure to remove the worksheet titles.
Once you're done, you need to create a parameter in order to handle all the N possible choices, and according to that you need to create N Calculated fields with a condition like this one:
if [Param] = 'Profit' then 'ok' else 'ko' end
Each calculated field will be used as a condition (select just ok values) in your filter selection.
Since the parameter can accept just one value a time, you will have just one of your N worksheet displaying data.
And this is the trick based on the vertical conatiner: if you hide worksheet titles, you will see "something" just for the selected worksheet and Tableau automatically will handle all the vertical space in the container.
The result will look like the following:
Adding to Fabio's great answer, these resources about collapsing containers may be useful:
Sheet swapping using collapsing containers
Automatically resize items in a Tableau container (or make disappear in your case)

Graph based on the user filter selection

On a tableau dashboard there are 2 filters and a bar graph.
The filters are 1. to select top or bottom customers
2. how many ex:5,10,15 etc
when the user selects top and 5 in the respective filters then top5 customers have to show in the bar graph.
if the user selects bottom ,10 in the respective filters then bottom 10 customers have to shown in the graph.
how to achieve this when the data contains only customers details and their billing amount ?
Instead of filter, you can go with the Parameter for getting the result. I have done the top and bottom multiple times in many of the tableau visualizations and its so easy.
Below are the steps to achieve your requirement.
Create a parameter that will allow you to select top and bottom
Create another parameter that will allow you to select the desired numbers like 5, 10, 15 etc.
Here i have created a parameter that will have values from 10 to 50 in a step size of 10.
Create a calculated field that will subset data based on the parameters chosen
In the above screenshot, I am using the top site parameter and creating a conditional statement that will show the states based on the value chosen in the site parameter and the value for that state.
Put the calculated field in the filter and select show and click ok in the filter box.
Now the view will show the top count based on the value selected in the parameter.
Please note the calculation is for top N and for bottom N you need to change the calculation.
Hope this will help you. I can provide you a workbook if you need.

How can I add an Average column to this text table?

I'm building my first dashboard in Tableau and I'm just beginning to learn all the nuances. Right now, I have a basic text table as shown in the image below. I'm trying to add an "Average" column at then end which will give the average per "Assignee" across the 5 fiscal week's shown. I assume there must be a pretty simple way to do this, but I've searched all over and cannot figure it out. I've been able to change the "Grand Total" column to show averages, but not add an additional column so I can display both data points. Can anyone provide some insight into how to make this work?
There are two things you can do:
Go To "Analysis/ Total/ Show Row Grand Totals" and the go to "Analysis/ Total/ Total All Using/ Average" This will give you the row and column averages. Your questions sounds like you want row average but column total, so you should try the second option.
Create a calculated field with WINDOW_AVG(sum([YourMeasure])) (Replace [YourMeasure] with the meassure you want to average. I couldn't see the full name in the screenshot) I will call it AverageMeasure
Then drag the AverageMeasure pill into the rows shelf, right click it and choose "Discrete".
It should look something like this now (I used the Tableau default data set):
If you want to format the number properly, right click on the AverageMeasure in the measures section, choose Default Properties/ Number Format and choose whatever you prefer.

Show calculated measure in row?

I'm using Tableau Desktop 9.0 on OSX. I have data (loaded from a local CSV file) that looks like this:
code,org,items
0212000AA,142,10
0212000AA,143,15
0313000AA,142,90
0314000AA,143,85
I want a chart that shows the number of items beginning with 0212 as a percentage of all items, for each organisation. (I mean as a percentage of the organisation's items - for example, in the above, I would like to show 0.1 (10/(10+90)) for organisation 142.)
I have been able to get part way there, by adding org to Columns, and SUM(items) to Rows. Then by adding a Wildcard filter on code, for starts with 0212.
This shows me the number of items starting with 0212, by organisation.
But what I don't know how to do is show this divided by the value of all items for the organisation.
Is this possible in Tableau, or do I need to pre-calculate it before loading my data source?
One way is to define a calculated field called matches_code_prefix as:
left(code, 4) = "0212"
You can also define a parameter called, say, code_prefix to avoid hard coding the prefix string:
left(code, 4) = code_prefix
And then show the parameter control for code_prefix to allow the user to interact with it.
If you use this new field as a dimension to separate SUM(items) according to those that match the prefix and those that don't, you can then use a quick table calculation to get the percent of total.
For example, you can place org on the Rows shelf and matches_code_prefix on the Columns shelf, and SUM(items) on the Text shelf to make a table. Then under the analysis menu, turn on grand totals for both rows and columns to see the behavior. Next, right click on SUM(items) and choose Quick Table Calc->Percent of Total. Tableau will display the percents of total in the table.
If you want the percent of total defined differently than the default, then right click on the measure again and set Compute Using to a different value such as matches_code_prefix in your case. It's usually better to set compute using to a specific field.
If you only want to display the value for the matching case, select the column header you don't want to see and choose hide. You can also turn off the grand totals from the analysis menu when you are done.
When you are confident in the values in your table, you can turn it into a bar chart for example by moving matches_code_prefix to the detail shelf and the measure to the Columns shelf.
--
The above is the drag and drop approach. If you prefer to hard code everything in a single calculated field that is calculated on the database side, you could instead define a calculation such as:
zn(sum(if matches_code_prefix then items end)) / sum(items)
Then set the default number format for that field to display as a percentage

How to color code cells of a column based on the text value in Tableau

I'm a new tableau developer trying to develop a table based tableau report. I have a column in the table called "Status" which essentially contains 3 values "In progress" , "Blocked" and "Completed". I want to color code the cells of this column based on these text values. I was unable to get this from the tableau community and hence posting it here. Anyone faced this problem? Kindly let me know how you solved it.
Raghu
First thing, Tableau is not excel. Stop trying to make Tableau work like excel, you'll miss most of the power Tableau brings, and make it inefficiently operate like Excel.
That being said, let me give you an alternative. Instead of text chart (which is what you're using to get a table), select Shape chart. This will add balls in the last column (but you can choose what shape you want)
Now drag the Status to color, and voilĂ , the balls are painted accordingly to Status. You can customize the shapes too (just drag some field to Shape), and selected what shape and color you want to each value.
This will look more like a "control panel", with the color of the balls something like a traffic light. You can even import some pictures of traffic lights and use them as shapes, that could be cool (if properly used)
I know this post is a couple years old, but there is a way to do this. In a new tableau workbook, import the data from Excel (just one column with the status values). Rename the table to "Status Colors" with a dimension field called "Status". Click the dimension field "Status" and select Default Properties > Colors. Assign the colors to each data item (value). For custom colors (RGB, HTML, etc.) double-click the color next to the value and assign the desired color. Click OK, then publish the data source to the server with the options checked to "Include external files".
You now have a Tableau data source that can be added as data to any other workbooks that when linked, the [Status Colors].[Status] can be used as the color key for the field on any graphs. The default colors are stored in the data source. If you update the color workbook, then it will update any other workbooks that use this data source.
Since SO community has thrown it in active threads, let me propose an answer. Though, I completely agree that we shouldn't replicate features of excel in Tableau, yet here is one workaround.
I took a dummy data like this
create a calculated field say status cf with the following calculation
CASE [Status]
WHEN 'In Progress' THEN 'Yellow'
WHEN 'Completed' then 'Green'
WHEN 'Blocked' then 'Red'
END
create two more CFs say 1 and 0 with just 1 and 0 in these as calculations.
Drag dummy and status to rows shelf. sum(0) and sum(1) to columns shelf.
Drag status cf to sum(0). Edit sum(0) in marks card with type as shape (square), and increase its size. edit colors as fixed in calculation.
Drag status to label in sum(1) in marks card. change type to text
Convert both measures in columns shelf as dual axis.
After a little formatting, you'll get a text table like this
You may optionally hide, status col in rows shelf