Right.
So, we are ready to go back to Tableau and perform a few additional operations with the
table we created earlier.
Right now, it shows us the number of units sold by the firm in each month of 2016 and
2017.
Let’s change this measure.
What I would like it to show us is the revenue the company generated during each of these
periods.
How can I do that?
Well, it’s fairly easy.
Our source data contains information about price and Tableau counted the number of units
sold (each row shows us a single car sale, right?).
Therefore, if we multiply the “Price” field and the auto-generated “Number of
records” field, we would obtain Revenues.
Do you agree?
Ok.
Good Let’s do that.
We already know how to create a calculated field.
I’ll name it “Revenue”, and will take advantage of Tableau’s auto-complete suggestions
multiplying “Price” and “Number of records”.
See?
As we said in our previous lesson, we can use the “star” operator to carry out a
multiplication.
One very useful feature you have probably noticed, is that at the bottom of the screen
Tableau tells us whether the calculation we’ve entered is a valid one or not.
Right now, my calculation is valid.
If I remove a few symbols, Tableau would indicate that the calculation contains errors.
This is a good guiding light when we create a calculation.
Right, so this is our “Revenue” field.
We can easily substitute the “number of records” data in the table with it.
All I have to do is drag the “Revenue field” and position it over the “number of records
data”.
Tableau replaces the two fields.
Perfect.
An important metric contained in our source data is ‘Gross Profit’.
By definition, ‘Revenue’ minus ‘Cogs’ equals ‘Gross Profit’.
Currently, we have ‘revenue’ and ‘gross profit’.
Let’s calculate ‘Cogs’ as the difference between the two.
That’s easy to do.
All we have to do is use the minus operator.
Nice.
Let’s order our table in the following way.
First, we’ll have Revenue, then Cogs, and finally Gross Profit.
I can do that by dragging and dropping the three fields within the table.
Please note that their values appear in the “measure values” card on the left side
of the workspace area.
We can change their order either from here or directly inside the table.
It’s up to you.
One more thing.
You have probably noticed the “measure names” field, which appeared in the “columns”
section.
This is an auto-generated field Tableau uses in order to form our table and separate the
names of different measures.
If we were to remove it from the columns section, the table will lose its shape as all three
measures will be put together.
Let’s press Ctrl and Z and undo this action.
Ok.
Excellent!
In our next lesson, we’ll learn how to add totals and subtotals to our tables in Tableau.
This will do for now.
Thanks for watching!