Placeholder Image

Subtitles section Play video

  • Ok.

  • Perfect.

  • In this lesson, well continue exploring some of Tableau’s main features.

  • In particular, well learn how to create a table with data, and add some custom fields.

  • The table we will create is going to be a pretty simple one, providing a monthly and

  • yearly breakdown of a company’s sales.

  • As you can see, our original data source contains a column calledPeriod”.

  • This is where we have both yearly and monthly data.

  • The first four characters designate the year when a sale was made and then the last two

  • contain information about the month when the sale occurred.

  • What I would like to do is split this information into two separate custom fields – “Year

  • andMonth”.

  • The way to do that is to go to theAnalysistab and create a calculated field.

  • Right.

  • Once this dialog box opens, I’ll type the name of the field I am creating, which is

  • Year”.

  • Then, I’ll use the LEFT function in order to take the four leftmost symbols of thePeriod

  • field.

  • This is where we have the year when they sale occurred.

  • LEFT is a function most of you are probably familiar with.

  • In Tableau it works in the exact same way, as it does in Excel for example.

  • In our next lesson, well pay extra attention to the different types of operations you can

  • do to create custom fields.

  • Ok.

  • Tableau recognizes we are writing the LEFT function and it helps us with autocomplete

  • suggestions.

  • The LEFT function needs two arguments from us – a String, which in this case is the

  • Periodfield we have in our source sheet.

  • So, I’ll typePeriod”, and as I do that Tableau manages to recognize I’m referring

  • to thePeriodfield and allows me to select it right away.

  • The second component of the formula is the number of characters we would like to extract.

  • Well need four characters, and that’s what I’ll write here.

  • Close the brackets and our new field is ready.

  • If thePeriodfield was not of the string type, we would have had problems because LEFT

  • is a function that requires us to use strings.

  • I’ll change the data type of thePeriodfield, and as soon as I do that Tableau shows

  • us a warning sign next to the newly generated fieldYear”.

  • And it doesn’t allow us to drag this field into the workspace area.

  • Basically, we can’t use it.

  • Ok, I’ll change the data type of thePeriodfield back to string and this issue will be

  • resolved.

  • Now I can easily drag the year field into the workspace area.

  • See?

  • Perfect.

  • The other field I would like to create ismonth”.

  • And in order to do that, I’ll use the RIGHT function.

  • Again, well need to go toAnalysis’, and create a calculated field.

  • First, well assign it with a name – “Months”.

  • And then I’ll type in the RIGHT function, following the exact same procedure as before.

  • The string well need is the same (“Period”), and the number of characters well need

  • is two, given that months are the two rightmost characters within thePeriodfield.

  • Excellent.

  • Now we have our second field – “Months”.

  • Let’s add it right next to years in the workspace area.

  • I can do that in two ways.

  • I can either drag the field into the workspace area and place it right next to the years

  • information, or alternatively drag theMonthsfield right next to theYearsfield

  • in the rows part of the screen.

  • The output is the same.

  • Ok.

  • Great!

  • Weve managed to create a nice table that groups all twelve months of 2016 and all twelve

  • months of 2017.

  • I’ll simply insert the auto-generated fieldNumber of records”, which represents

  • a simple count of the rows we have in our source data.

  • And voila!

  • This is a nice table that show us the breakdown of the company’s total number of sales for

  • each month in 2016 and 2017.

  • Awesome, right?

Ok.

Subtitles and vocabulary

Click the word to look it up Click the word to find further inforamtion about it