Ryan shows you how to use parameters that control the y-axis, x-axis, and dimensional breakdown on a scatter plot. This allows your end users to build their own chart by simply making selections from a dropdown list!
Hi. This is Ryan with Playfair Data TV. And in this video, I’m going to show you one of my favorite dashboard elements, which I call the parameterized scatter plot. The reason that I like this dashboard element so much is it’s very prescriptive. And it allows my end user to control the analysis. We’re going to set up a scatter plot and allow the end user to choose the value that is generating the y-axis, the x-axis, as well as the dimensional breakdown or the dimension that is creating the circles on the scatter plot.
To get started, I’m over here in the Sample Superstore data set. This uses the same exact tactic or functionality that you’ll find on the video, how to allow your end user to choose measures and dimensions in Tableau. It’s one of my all-time favorite tactics. But I’m going to show you a really good application of that tactic.
Some people don’t know that you can actually use that same tactic multiple times on the same chart. And what is so powerful about that is it allows your end user to really get the most out of Tableau without even needing to know how to author. You’re actually going to develop the user experience for them. They don’t need to know how to do that part. They simply need to know how to use a dropdown list.
We’re going to create a simple one. Because you could take this a step further and use any fields that you want. This could be a long list of 20 different fields. So I’m just going to show you a very basic introductory example. And we will use three measures and three dimensional breakdowns.
The first step is to create a parameter. So I’m going to create a parameter. And I will call this my y-Axis Measure. And we will allow our end user to choose from three different words. So the data type should be String. And for the allowable values, I will choose list because I have such a specific list of three choices. And those three choices, we will say, will be Sales, Quantity, and Profit Ratio. Again, you could use whatever fields you want represented on the y and x-axis. I’m going to use these three for now and click OK.
I’m now going to create a calculated field because that parameter does almost nothing on its own. I’ll show you one thing that that parameter does at the end of this video. But it almost always needs to be used within a calculated field that gives Tableau instructions for what to do with each of the allowable values that you’re letting your end user choose from.
So this is my y-axis. Actually, we’ll just call it y-axis. Because that will literally be our y-axis. And the syntax is Case, the name of our measure– so y-Axis Measure– got a couple extra characters in there. And then on each row, I need to tell Tableau what to do with each of those three selections. So when Sales is selected, I want Tableau to show the SUM of Sales. When Quantity is selected, I want Tableau to show the SUM of Quantity. And when Profit Ratio is selected, I want Tableau to show Profit Ratio.
Notice, Profit Ratio is already a calculated field. So it’s already being aggregated. We don’t need to sum it again like we did with Sales and Quantity. And then the word END at the bottom. So there’s the entire formula. You would obviously plug in your own metrics or words, so your own allowable values into this formula. But those are the three that we are going to allow the end user to select in this first example. I’m going to click OK.
The x-axis will be a little bit easier to create because we can just duplicate both the y-Axis Measure parameter as well as the y-axis calculated field that we created. These do need to be separate. Because we don’t want one selection to control both the y and the x-axis. So we need both of these to be separate. So I will first duplicate the y-Axis Measure parameter. And I will edit it so that it is called the x-Axis Measure.
The allowable values will be the same. So far, so good. I’ll click OK. And I also need to duplicate the y-axis calculated field that I created earlier, which you can do by right-clicking and clicking Duplicate. And I will edit this one as well. I need to make two changes on this one. Not only the title, but also making sure it references the correct parameter. So where it says CASE y-Axis Measure, I need to change that to x-Axis Measure. Everything else will remain the same. I’ll go ahead and click OK.
And now we can start to build this out a little bit. I will put the y-Axis onto the Columns Shelf– I’m sorry, the Rows Shelf– because we want that to create a y-axis. And then the x-Axis calculated field I will put on the Columns Shelf. And I’ll change this into a Circle and make it a little bit bigger so that we can see it. So what’s happening right now and why you see those axes look exactly the same, it’s because both of them have a current value of Sales.
But if I show both of these parameter controls by right-clicking on each one and clicking Show Parameter Control, I see a filteresque-looking dialog box appear in the top-right corner. That’s actually called a Parameter Control. And my end user now can choose from one of those three allowable values that I coded in the first step. So if I wanted to keep the y-axis as Sales but modify the x-axis to look at Profit Ratio, now the x-axis is showing Profit Ratio and the y-axis is showing SUM of Sales. So far, so good.
We just see one circle at the moment. That one circle represents the combination of all of our sales values by all of our profit ratio values. We haven’t specified anything more granular than the entire dataset. If I were to put Segment on Detail, for example, we now see three circles instead of one. We’ve changed the dimensional breakdown. Well, you can also parameterize that dimensional breakdown. So again, I’ll just show you this with three examples.
I’m going to create one more parameter. And I’ll call this my Scatter Plot Breakdown. Once again, the data type should be String. And I’m providing a very specific list of allowable values. So I’ll choose List and just type these three in. We’ll start with Segment. But we will also allow them to look at Category if they want to and Region. I’m going to click OK.
Again, does almost nothing on its own. I need a calculated field that gives Tableau instructions for what to do with each of those three choices. So I’ll call this my Dimensional Breakdown. And it’s the same logic or same syntax here, CASE, the name of the parameter. If it turns purple, you know it recognized that field as a parameter in your dataset. When Segment is selected, I want Tableau to show the Segment dimension. Notice this time there’s no aggregation. We’re using dimensions instead of measures.
So that line is good. The next one was Category. When Category, I want Tableau to show the Category dimension. And When Region, I want Tableau to show the Region dimension. And then these always conclude with the word END. So same syntax but I used a different parameter and then coded the three allowable values, which in this case are dimensions instead of measures. Going to click OK.
I’m going to replace the Segment dimension that is currently on the Detail Marks Card with that newly created Dimensional Breakdown calculated field. And when I do that, we shouldn’t see anything change. Because remember, the first value– or the current value in this case– of that Scatter Plot Breakdown parameter is Segment. So we already had Segment on the view. We replaced it with the parameter but the parameter is still generating Segment. So that’s what I expected to see so far.
But now, again, if I show the parameter control, the end user can choose from these three different dimensions. If I choose Category, we see the view change. When I hover over these, notice that, in the tooltip, it’s now showing me the names of categories in the Sample Superstore dataset. And if I go to Region, we should see four circles. Because there are four regions instead of three categories or three segments. And sure enough, that’s what we see.
So again, we are transferring the control of this analysis from ourselves to our end users. They don’t even need to know how to make a scatter plot in Tableau. They just need to know how to use these three parameter control dropdowns to choose how we’re breaking up the chart. I told you, I promised you that I would show you one thing that these parameters do on their own. Notice the y-axis is named the name of the measure that’s on the Rows Shelf. And the same thing with the x-axis. That’s not a great user experience or design.
The one thing you could use these parameters for on their own is to generate axis titles. To do that, simply drag the name of the, or the parameter field to the Rows Shelf for the y-axis. And I’m going to drag the x-axis version to the Columns Shelf. And you can already kind of see this coming together. But you can see it says Sales and Profit Ratio now. And if I wanted to, I could hide everything else. I could hide these labels.
I could edit these axes and remove the original name completely. I can do that for both the y-axis and the x-axis just to polish this up a little bit. You could even take this a step further and do more formatting. You can actually rotate the alignment and all kinds of stuff to kind of pretty this up. But now the axis will be titled whatever I choose in both the x-axis parameter control and the y-axis parameter control.
This has been Ryan with Playfair Data TV – thanks for watching!