Logical calculations can make your analyses richer. They can also make things easier for a dashboard consumer. For example, logical calculations can help you to funnel the analysis to specific-dimension members, combine members to follow a business rule, or even remove values that are irrelevant to your investigation.
Normally, when we use filters, we select the attributes within a dimension. In this recipe, we will implement logical calculations so that users can choose different dimensions to describe the data. We will place a small control on the dashboard so that users can simply click to choose the dimension that they would like to see, which describe the sales amount data. Users can simply click on which dimension they would like to see, for example, by color, country, or product line.
In this recipe, we will need to make a calculated field using a logical calculation and a number of parameters, amend the colors, and so on. Our sequence is to set up some parameters, a calculated field, and then some filters. So, let's get started!
For the exercises in this recipe, we will continue to use the Chapter
5
workbook. There is no need to add any more data. Let's make a copy of the KPI Sparkline worksheet and call it KPI Dimensions
. We will also make a copy of the dashboard and call it KPI Dimension Analysis
.
Choose Characteristic
and will set up a list for each metric. Make sure that you set up List as an allowable value and type each metric name in the list of values.CASE
statement, which is simply like lots of IF…THEN…ELSE
statements strung together. The calculation will execute the first statement that it finds to be true.CASE
statement that chooses between dimensions, dependent on the user selection. We will offer the following choice of different measures so the dashboard consumer can select the measure they would like to see on the dashboard:CASE [Choose Characteristic] WHEN "All" THEN "All" WHEN "Color" THEN [Color] WHEN "Country" THEN [SalesTerritoryCountry] WHEN "Product Line" THEN [ProductLine] END
CASE
calculation allows us to simply show all of the data not described by any dimension, or show by color, country, or product line.Calc_ChooseCharacteristic
.CASE
statement evaluation in the Calc_ChooseCharacteristic calculation, and this is how Tableau differentiates in the display. We will need to make sure that users can select their preferred dimension, and to do this, they will need to see the parameter control. And you will need to see it in order to test it out! Simply go to the parameter called Choose Characteristic, right-click on it, and select the Show Parameter Control option.How well did sales perform, by different characteristics?
.In this recipe, we implemented logical calculations that allow users to change the dimension that appears on the dashboard. We are starting to make our dashboards look more interesting and more interactive.
Showing different dimensions helps the dashboard designer to make the most of the space, while maximizing the choices available to the dashboard user. Setting up all of the moving parts is not as quick as other visualizations, but it is worth the effort to help the users.
For this recipe, we will use the KPI Dimension worksheet and see the result in our dashboard.
In this chapter, we have looked at many different ways to help users to engage with dashboards, such as choosing visualizations and making use of items to help with analysis such as parameters, Big Data technologies, and conditional logic. These tools will allow us to create dashboards that are powerful and rich, and who knows, maybe even fun!