Databases Reference
In-Depth Information
A use case
You should be advised upfront that the
If
function is, in fact, resource heavy. It's
often a good alternative to move all calculations based on the
If
function from the
frontend to the script whenever possible and handle the results through calculated
fields or flags in the data model. However, there are cases in which the calculation
cannot be handled anywhere but in the frontend. Here, we describe one scenario in
which you can take advantage of the
If
function's capabilities.
Heat charts
A heat chart is a cell matrix in which each individual value is color-coded based
on a threshold. We will create one of those charts using the
Airline Operations
document to demonstrate the concept.
1.
From the
Airline Operations.qvw
document, activate the
Analysis
tab.
Then, click on the
Create Chart
button from the design toolbar.
2.
From the
New Chart
dialog window, select the
Pivot Table
option in the
Chart Type
section and enter
Load Factor % Heat Map
in the
Title
field.
3.
Click on
Next
and the
Dimensions
dialog will appear, from which we will
add the
Carrier Name
,
Year
, and
Month
dimensions to our new chart. Click
on
Next
to continue to the
Expressions
dialog window.
4.
From the
Edit Expression
window, type the following expression:
$(eLoadFactor)
5. Click on
OK
to close the
Edit Expression
window and, from the
Expression
dialog, type
Load Factor %
as the expression
Label
.
6. Next, we will define a background color from the expression's attributes. To
do that, click on the small plus sign located next to the expression name in
the
Expressions
dialog window. Highlight the
Background Color
attribute.