In this video, we offer a step-by-step tutorial that teaches you exactly how to create calculated fields in Tableau.
Check out our Tableau overview to learn more, or see our full list of the best BI software.
In this video, we offer a step-by-step tutorial that teaches you exactly how to create calculated fields in Tableau. Check out our Tableau overview to learn more, or see our full list of the best BI software.
Hi! I’m Kyle, and today I’m going to show you how to create a calculated field in Tableau. Now this video assumes that you’ve already connected data to Tableau, via a file, server, or google drive. If you haven’t done that yet and need some help, you can check out my last video on that topic, either in the description below or in the annotation in the top right corner of your screen. Otherwise, let’s get goin’. If you’re unfamiliar with the term, a calculated field in Tableau is when you have two or more fields of data from your data source, but you want to display a field that’s an interaction between the two.
Perhaps you want to show the difference between two fields, or you want to have them multiplied together, or something along those lines. In this example, we’ll be using the fields “conversions” and “pageviews” from our test data we connected in the last video and divide the conversions by pageviews in order to show a new, calculated field, conversion percentage. If you’re familiar with making pivot tables in Excel, this process is pretty similar to that.
So first off, I’m going to grab the data that I want displayed by row, or horizontally across this table, and click and drag it into the ‘rows’ box. Now you’ll see all the different pages from my dummy sheet will fill in as separate rows. Now I’m going to add our measures to this table to the ‘filters’ box. This will allow us to only show the measures that we want to see. So you’ll see this Filter Box show up and I’ll be able to choose which of the fields we want to show.
I’m only concerned with conversions and page views at this time, so i’ll just make sure those two are checked and leave the rest unchecked and then hit OK. And now that we’ve filtered things down to what we want to see, we can take that same ‘measure names’ item and drag it over into the columns box. Nothing happens immediately, and that’s ok! While we have the structure set up now, we have to actually populate the values. So I’m going to grab the ‘measure values’ item in the lists that’s in the values section and drag it over to ‘text’ which you can find in the marks menu box.
And bada-bing-bada-boom, we’ve got the two fields we’re looking for. I can drag out the width of these too to make sure they’re easier to read. You can also drag and drop the two values in this box here if I want to arrange them differently, like if I wanted to have pageviews before conversions, for example. This is great and all, but we didn’t just want to see the same info from our data source reiterated, we wanted to see a CALCULATED FIELD. So let’s move on to that part.
Calculations can be as simple or complex as we want them to be in Tableau. For this example, since we’re all still learning, we’re going to go with a very simple one. As a reminder, all we want to see is a conversion rate, which means we’ll just be taking our conversions value and dividing it by our pageviews. So I’m going to go to conversions, right click on it, go to ‘create’, and then select Calculated Field. A dialogue box will pop up. First, give it a name.
This’ll help keep things organized so you know what you’re looking at. We’re going to name this one ‘Conversion Rate.’ since we started this by right clicking on conversions, it’s already populated here in this big text box. Now, for conversion rate we want to divide conversions by pageviews, so I’ll just type slash and then pageviews. What’s nice is I don’t even have to type in all of pageviews. If I start typing it in, Tableau will recognize that I’m typing one of the fields we already have built out and I can just click on that and it’ll autofill for me.
Now, conversion rate used division but you can use all kinds of arithmetic and other kinds of functions including if/then statements. You’ll see at the bottom left of this pop up, Tableau automatically lets us know "the calculation is valid,” and conversely it will notify you if your syntax is wonky or incorrect. We’re in the clear though, so I’ll hit OK. There’ll now be a new field titled conversion rate. You’ll see its icon has an equals sign next to it, signifying that this is a calculated field.
In comparison, the ones without that equals sign are native to our initial data source. Now there’s one more thing we want to do before we throw this into our table over here, I’ll want to change this to a percentage. TO do that, I’ll right click conversion rate, i’ll go to default properties, then go to number format. Here we have a handful of default options to choose from, since we’re dealing with a rate we’ll go to percentage. Once I have it set the way I want, I’ll hit OK.
Now I can click that field and drag it over into the ‘measure values’ box down here, and shazam. They appear here in our table. Lastly, if conversion rate is the most important thing we’re tracking here, we can sort our table to arrange things from highest to lowest conversion rate and vice versa. I’ll just click on the right side of the column header for conversion rate to sort things as I see fit, and there we go! Congratulations, you’ve created your first calculated field on Tableau.
That wasn’t too bad, was it? Hope you learned something and found it helpful. Tableau’s pretty neat-o, but if you want to check out the other BI tools out there, visit TechnologyAdvice.com for our list of the top options available today. Thanks for watching, and go be good and great, great and good.
In this video, we offer a step-by-step tutorial that teaches you exactly how to create calculated fields in Tableau.
Check out our Tableau overview to learn more, or see our full list of the best BI software.
At TechnologyAdvice, we pride ourselves on helping B2B tech buyers manage the complexity and risk of the buying process. We are a trusted source of information for tech buyers, delivering advice and facilitating connections between our buyers and the world’s leading sellers of business technology.