How to group rows in Tableau into bands? - tableau-api

I'm fairly new to tableau and I'm having the following issue. Below is a sample of the data I'm using.
Count | Item
___________________
1 A
3 B
2 C
3 D
5 E
2 F
5 G
9 H
I'm trying to group some of these together so I can show a stacked bar chart of these groups like the following:
Count | Item
___________________
6 A-C
10 D-F
14 G-H
How to do this?

Use Tableau's built-in Create Group feature
View and download the solution workbook on Tableau Public:
https://public.tableau.com/profile/fosstin#!/vizhome/HowtoGroupYourDatainTableau/Dashboard-HowtoGroupYourData
Right-click the Item dimension and choose Create > Group. This will open the Create Group dialog window.
At the top of the window, in the Field Name text field, enter a name for your grouped dimension or use the default title provided by Tableau, which is Item (group)
Select the first set of letters you wish to group, then click the Group button. Multiselect rows by holding down the control key or the shift key.
Type in a name for the group(i.e. A-C) and press enter.
Repeat steps 5 and 6 to create the D-F and G-H groups, then click OK.
Drag the Item (group) dimension to the Rows shelf and the Count measure to Text in the Marks card.
Add a column header to the Count column by double-clicking Measure Values in the data pane.
Right-click the Measure Values pill now on the Marks card and choose Format. Then, in the formatting pane, choose Numbers > Number (Standard)
References:
Tableau Help: Group Your Data
https://help.tableau.com/current/pro/desktop/en-us/sortgroup_groups_creating.htm#create-a-group-from-a-field-in-the-data-pane
Tableau.com Blog: The one-click trick for create headers for single-measure tables
https://www.tableau.com/about/blog/2015/11/how-create-fast-headers-single-measure-tables-45945

You can use a CASE statement to create the groups. I named it group in my example.
CASE [Item]
WHEN 'A' THEN 'A-C'
WHEN 'B' THEN 'A-C'
WHEN 'C' THEN 'A-C'
WHEN 'D' THEN 'D-F'
WHEN 'E' THEN 'D-F'
WHEN 'F' THEN 'D-F'
WHEN 'G' THEN 'G-H'
WHEN 'H' THEN 'G-H'
END
Then add group to your Rows shelf and Count to your text.

Related

Tableau Online: How do I get rid of the automatically displayed 'Abc' column when adding a field to Rows?

I'm trying to put together an Excel style report on Tableau where the rows have an id and some aggregated fields.
Eg.
id | sum(revenue) | sum(hours)
1. 100. 10
2. 200. 20
3 399. 40
However, whether I have just the ids or include the aggregated fields, there is an extra column. It has no header and displays 'Abc' in each row.
Eg.
id | sum( revenue) | sum(hours) |
1. 100. 10 'Abc'
2. 200. 20 'Abc'
3. 399. 40 'Abc'
What is this extra column and is there any way to hide it? Thank you.
Screenshot:
You can drag your measure into the text shelf and Ref Id to Rows. This will give you a text table.
Or you can drag your measure to Columns for a chart.
If you need to just show your Ref Id with no measure, you can hover over the far-right edge of the Abc area and when the double arrow icon shows, you can drag text area to the left to hide it.
You can hide by adding (" ") to your text column #Marks like shown in the picture Remove ABC

Crystal Report - Label Printing with a varied page counter

So, our branches are wanting shipping labels created which I have created a template on Crystal reports.
Our issue is using the NofM function. If the user prints one label it will say 1of1 which is correct. We want it so the counter is determined by the number of prints they require for example:
If the user prints 4 pages it will be 1of4 to 4of4.
Any assistance would be appreciated
In Field Explorer, expand 'Special Fields'.
Use the 'Page N of M' special field.
It sounds like you need a solution to duplicate the printing copies based on a parameter.
Option 1. if the max expected quantity is not too large, you can create multiple sections (Details a, Details b, Details c, ...) and use a dynamic suppress condition to hide the sections beyond the quantity parameter.
Option 2. Create a "REPEATER" table with a single column (How_Many) and rows for 1 | 2 | 3 | 4 | 5 | 6 | ...
Now, in your report, add the REPEATER Table and add a Record Selection condition of
{?QTY} >= {Repeater.How_Many}

How do I sort SSRS Table Column Group on an value in decending order?

How do I set this GroupExpression to order in descending order:  =Fields!ID_Count.Value in descending order?
To sort values in a group, including the details group, for a Tablix
1 On the design surface, click in the tablix data region to select it. The Grouping pane displays the row groups and column groups for the Tablix data region.
2 In the Row Groups pane, right-click the group name, and then click Edit Group.
3 In the Tablix Group dialog box, click Sort.
4 For each sort expression, follow these steps:
1 Click Add.
2 Type or select an expression by which to sort the data.
3 From the Order column drop-down list, choose the sort direction for each expression. A-Z sorts the expression in ascending order. Z-A sorts the expression in descending order.
5 Click OK.
https://learn.microsoft.com/en-us/sql/reporting-services/report-design/sort-data-in-a-data-region-report-builder-and-ssrs

How to filter top customers within certain section in Tableau

I have a Tableau file whose source is from one Excel sheet as shown below:
And it's how it looks in Tableau:
I have a Tableau sheet to show me the top 3 customers in each section. For example, company F, H, J, B, A are in section XXX, I filter section XXX only, sort F, H, J, B, A, select the top 3 customers and hit "keep only". So I have a table of top 3 customers in XXX section. Please see the pics below:
My question is, every month I have an updated Excel sheet with same format and I feed it into Tableau, the sales change every month but I always want top 3 customers in each section. For example, top 3 customers this month in XXX section are F, H, J but next month it might be A,B,H. However since I use "keep only" to filter F, H, J, the top 3 customers can only be F, H, J unless I manually change the filter. Is there anyway I can program Tableau to pick up the top 3 automatically whenever I feed new data to this file? I know "filter top n by" can do it but it can only filter by one variable, like they can only filter by sales instead of sales AND sections. I want to use "by formula" in the pic below to do it but I am not sure how to write the formula.
Have you tried to use the "Top" instead of "Condition" tab? You could also try to use a rank.
Create a calculated field "Rank", put index() into it, make it discrete and put it between your segment and customer pillow. Untick "Show header" and use it as a filter on the filter shelf.
I would use the Quick Table Calculation Rank. To do this create a new worksheet as follows:
Drag Section onto Rows
Drag Customer onto Rows
Drag Sales onto text mark
Drag sales onto detail
Right click the sales that you have dragged onto detail. Select Quick table calc and then rank.
Change this table calc from the detail mark onto the rank mark.
Now you can see what it is doing my default. You can see that is will be calculating the rank across all sections. As you mentioned you want the rank per section you just need to adjust the way the quick table calc is working. To do this right click on the measure and select edit table calc. Under Compute using you can change the way the calc is working. Select a couple of different ones to see what is happening. As you have structured the workbook to have Section and then Customer on the Rows shelf you should be able to use pane across then down. This means that it will calculate the rank per pane which in this case is per Section and will calculate down across Customer.
8) You can now drag this measure onto the filters pane and select a range of 1-3 this will filter the view to only show the top 3.
This method will work dynamically even when the data is updated :)

How do I make a Pie Chart in Crystal Reports that is JOINed?

I'm pretty new to Crystal Reports and I can create Pie Charts just fine, but I can't figure out how to chart a JOIN. For example, I have two tables "A" and "B". In the "link" tab of the Database Expert I've drug a line so that A.FK goes to B.PK.
Table A Table B
-------- --------
PK | FK PK | FK
0 | 1 1 | Gizmos
1 | 1 2 | Gadgets
2 | 2
The pie chart for A.FK would come out looking correct but the value in A.FK would be used in the legend, when I'm expecting the JOINed value of B.FK. So instead of my chart having two slices called 1 and 2, I want the slices to read Gizmos and Gadgets.
Can anyone please assist? Thanks
This is because you are grouping the report by A.FK - you need to change it to group by B.FK.
To do this:
Right-click on your chart and select Chart Expert.
In the Chart Expert dialog, click on the Data tab.
Select B.FK from the Available fields, and click on the first > button to add it to the list of grouping fields (to the right).
Select A.FK from the list of grouping fields and click on the first < button to remove it from the list. Your chart should now be grouped on change of B.FK.
Click OK at the bottom of the dialog.