Tableau, color-coded bar chart not working - tableau-api

Public workbook here. Source is Excel file.
I was able to create ordered bar chart based on (1) Location (2) Product
When I drag Above Three into Color, the graph is incorrect, how to troubleshoot?
Update
I made change such that Calculation computers based on Product, Above Three for each Location, at level Product.
However, Morton's still shows error.
The order in Mortons should descend, based on number of records, i.e.
Dark Chocolate
Beer
Toffee
Coffee
Fries
Rest of the Locations are correct, but only Mortons gives out-of-order products
Update2
Calculated Field Calculation3 = Index()
And I filter Calculation3 for 1 to 3, to display top 3 products
If I remove Calculation3 from filter, it gives correct order but it give ALL products, not the top three popular products (per Location).
I updated workbook to illustrate this. Please advise.

I don't know the purpose of the Index() field but that is creating your issue. Remove it from rows and the color appears to work the way you want it.

I hope this is what you are looking for
I have also published the file at the below address. You can take a view on that.
Tableau Wokbook
I achieved it by the following methods.
I changed the Calculation 3 field from Index() to RANK(SUM(NUMBER OF RECORDS)).
The calculation 3 was kept in between Location and period then edited the table calculation of calculation 3 by keeping the Addressing of the edit table calculation, having only the location and product as shown below and then Set the restarting every to Product.
You can check the workbook for more information

Related

Tableau filter based on multiple parameters?

I have some data like this below
data image see link
I would like to make a dashboard that will show you all the related empires based on what you choose (those that existed at the same time AND those in one of it's regions of influence). For example if I choose Rome then it will only show Egypt, Greek and Gaul and not show Byzantine because it is from a later time and not show China because it is in a different region. See below
See expected result picture in link
The simple way to achieve this task is to "Self-Join"
I would self-join the data again with Inner join on Region and Era
then, to handle the duplicate rows I would create a calculation
[Empire_Data1] = [Empires_Data2]
and put as false in the filter shelf.
then if you drag both Empires field you will the output you are looking for,
Since this is like 20 rows of data, you can perform a self join without any challenge.
But you have a lot of rows as in hundreds of thousands or more then, you might want to prep your data before connecting to the tableau.

How do I find the average age of users based on value of another column?

I have a dataset for health procedures with each patient listed under Index_Num. Most patients are listed several times as they have had several services. There is a column with their age.
There is another column called Portal_Use, which says "Yes" or "No" based on whether the user is a portal user.
The question I am trying to visualize in Tableau is the Average Age of Portal Users.
I created a group of the Index_Num, but don't know where to go from there. I'm essentially looking for a bar chart that has one bar for portal users and one bar for non portal users with the average age. This would be very easy if there weren't multiple rows per patient.
Based on your explanation I have used below data to generate the sample workbook.
Use your Portal_Use flag as a Columns
Add Age as an AVG value in Row section
From Show me section select the Type of Bar char you needed
Above will give you desired results as per below.
I hope this helps!!!

Tableau add formula to dashboard action filter?

I've got a workbook I'm building using public data https://public.tableau.com/profile/alee4645#!/vizhome/JSAClaimantsWardtimeseries/Dashboard1
The basics are working as I want, you see the map, you click on one of the coloured areas and a time series chart appears below the map showing the change over time for that area.
I want to add a couple of comparisons to this data, for example I want the time series chart to show a line for the whole coloured area (Somerset) so people can see how one part of it compares to the overall average.
I have the figures as separate rows in the data but of course when the action filter is triggered they get filtered out along with everything else.
If I edit the action filter in the filter shelf for sheet 2, it has the condition tab and I was hoping I could add [ward code] = "E10000027" (the comparison data I want to use) to the formula box so it would also keep the relevant rows of data, but that stops the chart working altogether.
I could achieve it by getting people to choose an area from a parameter drop down but I'd rather let them click on the map so they don't need to know the name of the area they are interested in.
Can this be done?

Displaying different sheets at user's demand in a single dashboard -- Tableau

I am new to Tableau. I am not sure if I can use Tableau to create the following type of interactive dashboard.
Say I have two almost irrelevant data sources. The first one contains daily revenue for some department stores.
Store Name Date Revenue
-----------------------------
Macy 6/29/16 50,000
Century 21 6/29/16 46,000
Macy 6/28/16 45,000
Century 21 6/28/16 48,000
...
I want to use line chart to study the Revenue. So I would use Date as the horizontal axis, and Revenue as the measure, while using Store Name as the color dimension. As a result, it will render several color lines to capture the revenue in terms of date.
For my other data source, it contains similar things. But instead of doing department stores, it contains information about fast food chain restaurants.
Restaurant Date Revenue
----------------------------
KFC 5/1/16 50,000
McDonald 5/1/16 46,000
KFC 5/2/16 45,000
McDonald 5/2/16 48,000
...
I use line chart to study the revenue again.
Now with the dashboard, is there any way I can have a control with menu Fast Food and Department Store, so that if the user clicks Fast Food, the line chart involving Fast Food appears and if the user clicks Department Store, the line chart involving Department Store appears?
So far, I've been able to use this helpful article http://kb.tableau.com/articles/knowledgebase/multiple-sources-one-worksheet to display Fast Food and Department Store at request. But if the user clicks Fast Food, he will get only one line, instead of multiple lines (one for each restaurant).
I hope I have described my problem clearly.
You can fairly easily do this using a parameter control and using it as a filter in your sheets.
First, create a parameter control "View Control":
Next, create a calculated field based on the parameter for each data source:
The calculation should match the data source ('Fast Food' for the fast food source, and so on)
Then place the calculated fields in the filter card and set to True. This should hide one of the sheets and show the other. They should never be shown or hidden at the same time.
Lastly, place both sheets and the parameter control onto a dashboard. It is best to place the two sheets within the same layout container. You should get the following result:
change parameter:

Showing comparison across groups in tooltip Tableau

I have a dashboard that lets users compare a company selected from a drop down menu (Company A) to another company chosen from another drop down menu (Company B). This then displays stacked bar charts (5 categories) by year. I want to build a tooltip so that when the user hovers over one of the 5 categories in either set of bar charts, it shows a comparison of that category between Company A and Company B. Is this possible, and if so, what is the best way to do this?
My previous answer showed a different approach for the problem without using too many workarounds. This answer will try to give exactly what has been asked.
First thing to understand is that you can't have the values for two different companies if you're filtering to show only one company. That means you'll need to circumvent this by filtering directly on the field.
Step 1: Create the new parameters that will be used as filters.
You want to create two parameters called "Company 1" and "Company 2" that will be used in each view to filter the company on the graphic.
Step 2: Create the new measures with the filter directly in the field.
Now you should create two new measures from your main measure, each one filtering one of the companies accordingly to the parameter, e.g. Sales Company 1 and Sales Company 2.
Step 3: Create a field with the variation and add it at the tooltip mark.
Simply enough, you want a calculated field with the difference between them:
SUM([Sales C1]) - SUM([Sales C2])
Step 4: Update the views and dashboard
Change the measure in each of the views for their following specific measure field, and remove the Company filter. And in the dashboard, substitute your usual filters to the parameter (which will be used to filter both views).
By assuming you have a dashboard with two views, you'll be filtering the [Company] in both of these views, making the value of another company not available to be shown at the tooltip.
If you're not using it yet, you could try a new approach and see the variance between companies by using the Color mark. By adding the [Company] as color, you could turn the Stack Marks off and add the second company in the filter to be able to visualize the difference.