Assignment 2 - Calculated Fields and Time Series Analysis in Tableau
Assignment 2 - Calculated Fields and Time Series Analysis in Tableau
Student Name:
Student ID:
Date:
Note:
Take all the screenshots uncropped i.e. date and time should be visible in your screenshots.
You need to submit your answers in a separate word document. No need to write the
questions in it. Put the question number and your solution. Do not provide the screenshots of
intermediate steps.
Your answer document should contain your name, net id and date.
Please turn in your answers in a word file and your twbx file.
There will be deductions for providing more than what is asked.
The objective of this exercise is to use learn how to create calculated fields in Tableau and to perform
time-series analysis. The data set is obtained from https://community.tableau.com/docs/DOC-1236 via
kdnuggets.com.
Step 1:
Import the dataset in Tableau. To import the data, you need to click on Microsoft Excel on the home
screen of Tableau and select the file to be imported.
Under sheets you will find the names of three sheets. If you look at your dataset in excel, you will find
those three sheets there. Now you can choose the sheet on which you want to create visualization. You
can choose more than one sheet too. In the case of selecting more than one sheet, a join will be created
based on the columns in the sheets.
For this exercise, we will select “Orders” sheet. To select the sheet, drag it to the area labelled with text
“Drag tables here”.
Click on Sheet 1 in bottom left corner.
Step 1:
The management of the store wants to invest $500K in the product “Sub-Category”, for all product
“Category” producing highest profit percentage i.e., (less cost price and maximum return).
We will try to find out the appropriate product sub categories for the management.
You can see the dimensions and measures on the right side of the sheet. You can find “Sales” and
“Profit” measures under the “Measures” section.
If you get a horizontal bar chart, click on “Show Me” and select “side-by-side” bars.
If you get “Sub-Category” in “Color” mark, remove it from there. We will apply “Color” later.
Now click on small sort icon on the “Profit” axis to sort the bars from highest to lowest.
What do you think? Are we done and can say that we have found the highest profit-making sub-
category of product under each category???
The answer is NO. We don’t know yet. We know the highest profit-making sub-category, but which sub-
category has the highest profit percentage, we are not able to answer that.
We need to create one. We know that profit percentage = (profit/cost price) * 100. We don’t have cost
price either, but we do have sales and profit and we know that cost price = sales – profit. So, our profit
percentage formula will look like
To do so, right-click anywhere in the “Measures” pane. A popup will appear. Click on “Create
Calculated Field”. Or “Create” -> “Calculated Field”
Now, right click on the sheet name at the bottom left corner and choose duplicate.
Is there any change in your answer from first sheet and second sheet??
Now click on “Label” under “Marks”. And change the font to 10 and make it “bold”.
Now click on “Color”. Go to the “Border” and make it black.
Step 2:
You will find that the default level of granularity of order date is “YEAR”. We will change it to month.
You can see that now we have three separate lines for each product category. One thing to notice is that
if you select on any of the options in the “Color” legend, you will have the line corresponding to that
legend highlighted in the sheet. This will help you make separate analysis of a category as compared to
others.
If you want to have all the points on the line, click on “Color”. Under Effects go to Markers and select All.
The above step is not required. Its only for your information.
The area chart is different from line charts. In area chart the measure value are stacked on top of each
other whereas in line chart the lines are independent.
Drag “Ship Mode” to Filters. On the window which appears, select ‘All’, then Apply and then OK.
Right click on Filter and then “Show Filter”.
You will find that the Filter “Ship Mode” will appear on the right side. By clicking on the small down
arrow, you can see a number of options to modify your filter. We will not use them here, as it is not
required in this visualization, but you should know this.
To Submit: