20
7/27/2019 Comparing Table Calculation http://slidepdf.com/reader/full/comparing-table-calculation 1/20  www.bispsolutions.com www.bisptrainigs.com www.hyperionguru.com Page 1 Getting Started with Tableau Description: BISP is committed to provi de BEST learning material to the beginners and advance learners. In the same series, we have prepared a complete end-to end Hands-on Beginner’s Guide for Tableau  The document focuses on steps involved in creating Comparing Table Calculations using Tableau  Join our professional training program and learn from experts. History: Version Description Change Author Publish Date 0.1 Initial Draft Surbhi Sahu 21 st  Feb 2014 0.1 Review#1 Amit Sharma 29 th  Feb 2014

Comparing Table Calculation

Embed Size (px)

Citation preview

7/27/2019 Comparing Table Calculation

http://slidepdf.com/reader/full/comparing-table-calculation 1/20

 

www.bispsolutions.com  www.bisptrainigs.com  www.hyperionguru.com Page 1

Getting Started with Tableau

Description:

BISP is committed to provide BEST learning material to the beginners and advance learners. Inthe same series, we have prepared a complete end-to end Hands-on Beginner’s Guide for Tableau The document focuses on steps involved in creating Comparing Table Calculations using Tableau Join our professional training program and learn from experts. 

History:

Version Description Change Author Publish Date

0.1 Initial Draft Surbhi Sahu 21st  Feb 2014

0.1 Review#1 Amit Sharma 29th Feb 2014

7/27/2019 Comparing Table Calculation

http://slidepdf.com/reader/full/comparing-table-calculation 2/20

 

www.bispsolutions.com  www.bisptrainigs.com  www.hyperionguru.com Page 2

Contents

Comparing Table Calculations ....................................................................................................... 3

Data Source as Access ................................................................................................................... 3

Set up the preliminary view ...................................................................................................... 11

Create a calculation for difference in sales ................................................................................ 11

Create a calculation for moving average ................................................................................... 14

7/27/2019 Comparing Table Calculation

http://slidepdf.com/reader/full/comparing-table-calculation 3/20

 

www.bispsolutions.com  www.bisptrainigs.com  www.hyperionguru.com Page 3

Comparing Table CalculationsWe can modify and compare table calculations. This activity shows how to compare the differencein total sales to the difference in average sales from year to year. It does this by creating thefollowing calculations:

  A table calculation that determines the difference in total sales from year to year.  A table calculation that determines the difference in the moving average of sales from year

to year.  A calculated field that subtracts the difference in total sales from the difference in the

moving average of sales from year to year.

Data Source as AccessMost database applications store their information in multiple tables , for accessing theinformation of the whole table we have require to access multiple tables.

Suppose we wants to import these tables in our tableau worksheet

In this data model OrderDetail is fact table and Product,OrderHeader and country+ are thedimension tables . And Salescountrycode , ordercode and productTypeCode is the primary key ofthe table 'Country' ,'Fact_Order' and 'ProductType' table.

Step 1)Firstly choose the data source with which we want to

connect as here is selected Microsoft Access.

7/27/2019 Comparing Table Calculation

http://slidepdf.com/reader/full/comparing-table-calculation 4/20

 

www.bispsolutions.com  www.bisptrainigs.com  www.hyperionguru.com Page 4

Step 2)Then browse for the

location of the access file

then click on Open.

Step 3)This will explore all the

tables so first select a single

table, which will be a fact table for

all the dimension table to be

imported.

Step 4)Then check Multiple Tables option .

By using this option we can import multiple

table in our tableau workbook .

7/27/2019 Comparing Table Calculation

http://slidepdf.com/reader/full/comparing-table-calculation 5/20

 

www.bispsolutions.com  www.bisptrainigs.com  www.hyperionguru.com Page 5

Step 5)Click on the Add Table, this will

explore all the table except the

OrderDetail which already been selected.

Step 6) Then select the table Product.

It will display all the fields of product.

We can remove any field by

deselecting from Table Fields . Forcreate join click on the Join option.

Step 7) Select the common field from both table and create join between them by pressing Add button After click on the Add Table button the join statement will be created between theproductnumber of the product and productnumber of the orderdetail table. In the table productproductnumber is the primary key but in orderdetail table it is the foreign key.

7/27/2019 Comparing Table Calculation

http://slidepdf.com/reader/full/comparing-table-calculation 6/20

 

www.bispsolutions.com  www.bisptrainigs.com  www.hyperionguru.com Page 6

Step 8)Here three joins are available Inner join ,Left join and

Right join.

7/27/2019 Comparing Table Calculation

http://slidepdf.com/reader/full/comparing-table-calculation 7/20

 

www.bispsolutions.com  www.bisptrainigs.com  www.hyperionguru.com Page 7

Step 10) Then the product table

will be add with the table orderdetail for

adding more table click Add Table

Button.

Step 11) This will explore all the table ,select the table orderheader for import .

Step 12) Now create the

 join between the tables

Oderdetail and order header

via ordercode.

7/27/2019 Comparing Table Calculation

http://slidepdf.com/reader/full/comparing-table-calculation 8/20

 

www.bispsolutions.com  www.bisptrainigs.com  www.hyperionguru.com Page 8

Step 13) Now the table orderheader

will added in relation ship with

orderdetail For adding more

table click on the option

Add Table.

Step 14 ) This will

explore all the table,select the table

which we want to

import so choose

the table

country_salesbranch

and create the join

using

salesbranchcode

which is similar inboth of the table.

 Then create a join

by using Add

button.

7/27/2019 Comparing Table Calculation

http://slidepdf.com/reader/full/comparing-table-calculation 9/20

 

www.bispsolutions.com  www.bisptrainigs.com  www.hyperionguru.com Page 9

Step 15) Here the three tables

Orderdetail

, country_salesbranch

Orderheader and product will

Added in the connection.

Step 16)Here’ s the query

Executing inside the tableau

while loading the

tables in the tableau.

7/27/2019 Comparing Table Calculation

http://slidepdf.com/reader/full/comparing-table-calculation 10/20

 

www.bispsolutions.com  www.bisptrainigs.com  www.hyperionguru.com Page 10

Step 17)Tableau ask for the connection

choose the connection Connect live.

Step 18) Now all the table imports in Tableau and Dimensionand Measure will be automatically separate by tableau itself.

7/27/2019 Comparing Table Calculation

http://slidepdf.com/reader/full/comparing-table-calculation 11/20

 

www.bispsolutions.com  www.bisptrainigs.com  www.hyperionguru.com Page 11

 Set up the preliminary view

Step 19)

From the Dimensions pane, drag Order Date to the Columns shelf, and Category to the Rowsshelf.

Step 20)

From the Measures pane, drag Sales to Text on the Marks card.

Create a calculation for difference in sales

For calculating the difference come in the current year sale from the last year sales we perform thebelow action.

Step 21)

On the Marks card, from the Sales drop-down menu, select Add Table Calculation.

7/27/2019 Comparing Table Calculation

http://slidepdf.com/reader/full/comparing-table-calculation 12/20

 

www.bispsolutions.com  www.bisptrainigs.com  www.hyperionguru.com Page 12

Step 22)

In the Table Calculation dialog box, complete the following steps:

  Use the default settings for these choices:  Calculation Type: Difference From  Calculate the difference along: Table (Across)  Display the value as a difference from: Previous

  Click Customize.

7/27/2019 Comparing Table Calculation

http://slidepdf.com/reader/full/comparing-table-calculation 13/20

7/27/2019 Comparing Table Calculation

http://slidepdf.com/reader/full/comparing-table-calculation 14/20

 

www.bispsolutions.com  www.bisptrainigs.com  www.hyperionguru.com Page 14

Step 24)The table is showing the comparison between the Difference In Sales and Sales differentway in the sells.

Create a cal culation for moving average

Given a series of numbers and a fixed subset size, the first element of the moving average is

obtained by taking the average of the initial fixed subset of the number series. Then the subset ismodified by "shifting forward"; that is, excluding the first number of the series and including thenext number following the original subset in the series. This creates a new subset of numbers,which is averaged. This process is repeated over the entire data series. The plot line connecting allthe (fixed) averages is the moving average. A moving average is a set of numbers, each of which isthe average of the corresponding subset of a larger set of datum points. A moving average mayalso use unequal weights for each datum value in the subset to emphasize particular values in thesubset.

A moving average is commonly used with time series data to smooth out short-term fluctuationsand highlight longer-term trends or cycles.

 The next steps continue with the same view to show how to build a table calculation andcalculated field for the moving average of sales from year to year.

7/27/2019 Comparing Table Calculation

http://slidepdf.com/reader/full/comparing-table-calculation 15/20

 

www.bispsolutions.com  www.bisptrainigs.com  www.hyperionguru.com Page 15

Step 24)

In the Measures pane, double-click Sales.

 The view now shows the difference in sales and sales figures for each category.

Step 25)

On the Measure Values card, right-click Sales and select Add Table Calculation.

Step 26)

In the Table Calculation dialog box, complete the following steps.

 For Calculation Type, select Moving Calculation.

  For Summarize values using, select Average.  Select the Perform a secondary calculation on the result check box.  Click Customize.

7/27/2019 Comparing Table Calculation

http://slidepdf.com/reader/full/comparing-table-calculation 16/20

 

www.bispsolutions.com  www.bisptrainigs.com  www.hyperionguru.com Page 16

Step 27)

In the Calculated Field dialog box, complete the following steps.

  For Name, type Difference in Moving Average of Sales (Custom).  For Formula, use the default formula that populates the text box:

ZN(WINDOW_AVG(SUM([Sales]), -2, 0)) - LOOKUP(ZN(WINDOW_AVG(SUM([Sales]), -2, 0)), -1)

7/27/2019 Comparing Table Calculation

http://slidepdf.com/reader/full/comparing-table-calculation 17/20

7/27/2019 Comparing Table Calculation

http://slidepdf.com/reader/full/comparing-table-calculation 18/20

 

www.bispsolutions.com  www.bisptrainigs.com  www.hyperionguru.com Page 18

Step 28)

In the Calculated Field dialog box, complete the following steps.

  For Name, type Difference between Moving Average and Current Sales.

  In the Formula box, build the following formula:[Difference in Moving Average of Sales (Custom)] -[Difference in Sales (Custom)]

7/27/2019 Comparing Table Calculation

http://slidepdf.com/reader/full/comparing-table-calculation 19/20

 

www.bispsolutions.com  www.bisptrainigs.com  www.hyperionguru.com Page 19

Confirm that the status message indicates that the formula is valid, and then click OK.

Step 29)Then double click on the Difference Between Moving Average And Current Sales.

Step 30)

In the Measures pane, double-click Difference between Moving Average and Current Sales.

Step 31) This is the sheet which comparing the sells , moving sells and difference between themoving sells and current sells.

7/27/2019 Comparing Table Calculation

http://slidepdf.com/reader/full/comparing-table-calculation 20/20

 

www.bispsolutions.com  www.bisptrainigs.com  www.hyperionguru.com Page 20