Saturday, June 25, 2016

Advance PARAMETER in Tableau

The following example shows how to create a single text box on a dashboard that filters a list of customers by Region or Product Sub Category. To create this type of filter, you will need to create a parameter, a calculated field, and a filter.




Note: Use this strategy when you want to filter on a single value at a time. For example, looking at only the East or only Tables products.
Create the parameter
The first thing you will need to create is a parameter. The parameter is where users will type in the Region or Product Category values.
Step 1 
Connect to your data source. This example uses the Sample - Superstore data source.
Step 2 
Right-click an empty area in the Data window and select Create Parameter.
Step 3 
In the Create Parameter dialog box, give the parameter a name such as Filter On. Then specify the parameter settings.


Step 4
Create a calculated field
Now that you have a parameter to collect the value you want to filter on, you need some way of specifying the filter. You can do that by writing a calculated field that compares the Region and Department values to the Filter On value.
Sub Step 1 
Select Analysis > Create Calculated Field.
Sub Step 2 
In the Calculated Field dialog box, do the following tasks:
  1. In the Name text box, type Show in View.
  2. In Formula text box, type the formula below, and then click OK.
if [Region]=[Filter On] and [Product Sub-Category]!=[Filter On] then 'Select'
ELSEIF [Region]!=[Filter On] and [Product Sub-Category]=[Filter On] then 'Select'
else 'Ignore' END

Step 5
Filter the view
The final step is filtering the view to only include the rows that were marked as "Select." (Note you have to first enter select then click on '+' button)





Step 6
When finished, click OK.Build the view
Now that you have all the pieces, build the view you want. Make sure you show the parameter control by right-clicking the parameter in the Data window and selecting Show Parameter Control.





Addressing and Partitioning


Table calculations are performed on a single measure in the view. The dimensions that define the part of the table you are applying the calculation to (computing along) are called addressing fields, and the dimensions that define how to group the calculation are called partitioning fields. In the example of a running sum of product sales across several years, the addressing field is the Date field, and the partitioning field is the product field. When you define the addressing for a table calculation, all the other dimensions are used for partitioning.
You specify addressing when you create or edit a table calculation, in the Table Calculation dialog box. To update addressing for a field in the view that already has a table calculation, right-click the field and choosing one of the options under Compute using. For example:



Addressing can be relative to the table structure (options beginning with Table, Pane, or Cell) or to a specific field (such as Category, Order Date, or Region). Addressing options based on table structure are described below.
Table (Across)
This option sets the addressing to compute along the entire table moving horizontally through each partition. For example, the view below shows quarterly sales by region and product category. When a calculation addressing is set to Table (Across), the dimensions that span horizontally across the table are the addressing fields (in the view below, Category and Region). All the other dimensions (Year, Quarter) are partitioning. The addressing dimensions are shown in orange, while partitioning dimensions are shown in blue.



That means that each partition will be the combination of Year and Quarter. Any calculation that is performed is scoped to the partition. For example, if the calculation is percent of total, the calculation will be performed on the numbers within each of the orange boxes.


Table (Down)
This option sets the addressing to compute along the entire table moving vertically through each partition. For example, the view from above is shown below with the addressing set to compute along Table (Down). The fields that span vertically (Year, Quarter) are now the addressing fields and the rest of the fields are partitioning (Category, Region). The addressing fields are shown in orange while partitioning fields are shown in blue.



That means that each partition is the combination of Category and Region.



Table (Across then Down)
This option sets the addressing to compute across the entire table horizontally and then down the table vertically. This means that both the fields that span across the table and down the table are addressing fields.



That means that the entire table is the partition. The computation will compute across, move to the next row and continue to compute across, and so on.



Pane (Across)
This option sets to compute across the pane horizontally. The fields that span across the pane horizontally are the addressing fields. However, the fields that separate the panes are now partitioning fields. In the example below Category becomes a partitioning field along with Year and Quarter. Region is the addressing field.





That means that the combination of Year, Quarter, and Category is the partition.



Pane (Down)
This option sets the addressing to compute down the table within the pane. The fields that separate the pane (Category, Year) are partitioning fields. In addition, Region becomes a partitioning field and Quarter is the addressing field.



That means that the combination of Year, Category, and Region is the partition.



Pane (Across then Down)
This option sets the addressing to compute across within the pane, then move to the next row and continue to compute across. The addressing fields are both the fields that run across the table horizontally and down the table vertically (Region, Quarter). The partitioning fields are the fields that define the pane (Category, Year).



That means that the combination of Category and Year make up the partition.



Cell
This option sets the addressing to the individual cells in the table. All fields become partitioning fields. This option is generally most useful when computing a percent of total calculation.



That means that the partition is the combination of Category, Region, Year, and Quarter.



Individual Fields
The individual dimensions in the view are listed below the option above in the Table Calculation dialog box. Use them to set the addressing to compute using the field you specify. The benefit of this option is that you get absolute control over how the calculation will be computed—if you change the orientation of your view, the table calculation will continue using the same fields for addressing and partitioning. Be careful though, because, addressing on an individual field means that when you rearrange the table, the calculation may no longer match the table structure.
Advanced
The advanced option lets you specify multiple fields to act as the addressing fields. When you select Advanced, a dialog box opens where you can specify one or more fields to act as addressing fields. Then you can specify how to order those fields.





For example, in the view below the addressing fields are set to Category and Year. These are ordered by SUM(Sales), in descending order (from greatest to least). That means that the combination of Quarter and Region create the partition. Q1 Central exists four times in the table, and that is the partition.



Because the order is set to SUM(Sales), the calculation is computed based on their SUM(Sales) values from highest to lowest.



Adding Data Refresh Time Stamp to a View in a Dashboard

Published: 25 Jan 2013
Last Modified Date: 09 Sep 2014
Question
How to add a time of the last data refresh (a time stamp) to a view in a dashboard.
Environment
Tableau Desktop
Answer
Option 1: Add the time stamp to the top of the view
  1. Open the workbook that contains the dashboard in Tableau Desktop, and then navigate to the sheet for which you want to display the time of the last data refresh.
  2. Select Worksheet > Show Title.
  3. Double-click the title.
  4. In the Edit Title dialog box, select Insert > Data Update Time, and then click OK.
Option 2: Add the time stamp to the bottom of the view
  1. Open the workbook that contains the dashboard in Tableau Desktop, and then navigate to the sheet for which you want to display the time of the last data refresh.
  2. Select Worksheet > Show Caption.
  3. Double-click the caption.
  4. In the Edit Caption dialog box, select Insert > Data Update Time, and then click OK.
Additional Information
The Data Update Time value depends on the type of connection:

  • Extract-based connections display the last time the extract was refreshed.
  • Live database connections display the last time the data source was refreshed.
  • Live file-based connections display the last time the file was updated.