Trouble attempting nested sort - tableau-api

I have a dataset with three fields: region, product, sales. I would like to display by-region bar charts of sales by product, with bars sorted within each region. I follow the recipe on
http://kb.tableau.com/articles/knowledgebase/nestedsorting
until I get to Step 4, at which point Tableau (9.2) shows me this.
What went wrong? And how do I get my nested sort?

... turns out I can do the desired sort this way.

Related

How to sum two different group by calculated fields in Tableau?

I have two calculated fields (HomeScore, AwayScore) and I grouped them by different dimensions(Home, Away). Now, I have TotalRuns per Team both in HomeGames and AwayGames. My problem is that I want to find the sum of TotalRuns per Team not separetely for home games and away games. I want to add these group-by fields somehow. I attach a screenshot to see my work. For example first column for both charts is "Arizona Diamondbacks" which has 263 Runs in first chart and 337 in the second one. I want to show the 263+337=600 Runs. Any Idea?
You'll want to create a LOD expression.
{FIXED [Team Name] : SUM([Total Runs])}
Think of your data as a big table (which it technically always is in Tableau). Every grouping, filter, etc. that you do narrows down the number of columns and rows you have left until you are left with your data set that contributes to your chart. LOD expressions allow you to back out of the filters, etc. in your calculation. In this case, you narrowed down to home or away games, and we are backing out of that to get a bigger picture of the data.

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.

Tableau, color-coded bar chart not working

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

Tableau Pie-Chart with Measures

I have data with many measures values for each SiteID, i.e.
Total Windows Total Mac Total Online Total Offline Total Computers SiteID
I have been googling how to create pie chart in Tableau, but these tutorials assume I have data that looks like
OS Status SiteID
What I am ultimately trying to do is create a pie chart of online vs offline users and use actions from other data points to filter that chart.
I just need to know how to create pie-chart and from there I can create action.
If I understand your question correctly, it sounds like you want to make a pie chart showing online users vs. offline users, and be able to filter it by SiteID.
You could do this by:
Go to Marks and select Pie.
Drag [Measure Names] into Color.
Drag [Measure Values] into Angle.
Remove all pills except for [Total Online] and [Total Offline] from the Measure Values card.
Then you can create a SiteID filter by creating a quick filter, dragging SiteID to the filter card, or using an action from a dashboard.
Sounds like you need to reshape your data. Can you use SQL to do so?

How can I change the order of values in a stacked bar chart in Cystal Reports?

I have a stacked bar chart in Crystal Reports which is used to display the number of employees in each process area that still require training.
Crystal automatically sorts fields in each bar on the bar chart alphabetically, this would normally be fine but I want to rearrange the order in which the areas appear so that they coincide with the production sequence.
I thought that I would be able to rearrange the order by going to Chart Expert>> Data>>Order and clicking on Specified Order. But this doesn't appear to be working so I must be doing something wrong.
Does anyone have any advice?
Any help is greatly appreciated.
I'm assuming the chart risers (= the bars) are coming from a grouping level you've specified in Group Expert and selected in Chart Expert.
Here's what to do:
In Group Expert, insert a second group. Leave the original group unmodified so you don't inadvertently affect the chart.
Set the new group to group by your sort key – the field that specifies the desired order of the bars.
Move the new group up in the group list – so it precedes the original group.
Suppress the new group's headers and footers.
Now Crystal will first sort your records by the sort key, and then by the field you're currently using. You should get the same risers in a different order.
Note: If the records for a given bar have differing values for the sort key, this won't work. If that's the case, you'll need a summary field and Group Sort Expert instead.
I just encountered this problem. My solution was as follows:
In the "Chart Expert" Select the field in the "On Change of" block
Click the TopN button
"For this group sort" to "All"
"based on" the field you want to sort by.
This will keep your bars labeled as their original category, but instead of writing in alphabetical order they will sort by the field you choose.