Subtitles section Play video Print subtitles Ok. Perfect. In this lesson, we’ll continue exploring some of Tableau’s main features. In particular, we’ll 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 called “Period”. 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” and “Month”. The way to do that is to go to the ‘Analysis’ tab 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 the “Period” 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, we’ll 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 “Period” field we have in our source sheet. So, I’ll type “Period”, and as I do that Tableau manages to recognize I’m referring to the “Period” field and allows me to select it right away. The second component of the formula is the number of characters we would like to extract. We’ll need four characters, and that’s what I’ll write here. Close the brackets and our new field is ready. If the “Period” field 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 the “Period” field, and as soon as I do that Tableau shows us a warning sign next to the newly generated field “Year”. 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 the “Period” field 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 is “month”. And in order to do that, I’ll use the RIGHT function. Again, we’ll need to go to ‘Analysis’, and create a calculated field. First, we’ll assign it with a name – “Months”. And then I’ll type in the RIGHT function, following the exact same procedure as before. The string we’ll need is the same (“Period”), and the number of characters we’ll need is two, given that months are the two rightmost characters within the “Period” field. 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 the “Months” field right next to the “Years” field in the rows part of the screen. The output is the same. Ok. Great! We’ve 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 field “Number 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?
A2 field tableau period workspace string table Build a table in Tableau: The steps needed to create a simple table in Tableau 10 0 林宜悉 posted on 2020/03/09 More Share Save Report Video vocabulary