Setting conditions on axes
When creating a visualization, you select which columns to present on the various axes, and how to aggregate the data. What is more, you can determine in more detail what to display by specifying conditional expressions on the axes. That way, what is shown in the visualizations depends on the conditions.
For example, the expression If([Amount]<10,"yes","no") says that "if the value in the Amount column is lower than 10, the result of the expression is yes, but if the value is 10 or higher, the result is no".
Below are some examples of how you can apply conditional expressions in different visualizations.
Conditional expression applied on the value axis in a bar chart
The example data contains test results for a number of people. To pass the overall test, the summarized result from Test A and Test B must exceed 30. Assume you want to show how many men and how many women succeeded, and leave out those who did not pass.
As a start, the bar chart is created with one bar per gender.
- Right-click the value axis selector to open the pop-up menu.
- Select Custom Expression.
Custom Expression dialog, enter the expression
Count(If(([Test A] + [Test B])>30,1,null)).
The result of the If function is 1 for those who exceeded the total of 30. For those who did not pass, the Null argument indicates that no value should be returned.Then the frequency of 1 is counted, split per gender.
- Click OK.
Conditional expression applied on the color axis in a map chart
You may want to distinguish cities with an average temperature higher than 20° C by coloring their markers differently from the other markers. This can be done by applying a conditional expression on the color axis.