Databases Reference
In-Depth Information
3.
Click on
OK
to close the
New Text Object
dialog window. The text
object should display
1145
.
We now have one of the three values we are interested in. To get the other two
values we will use essentially the same expression, only changing the
Max
function
with the
Min
and
Avg
functions to get the minimum and average values, respectively.
1.
Right-click on the text object we just created and select
Properties
….
2.
We will modify the
Text
definition to add the rest of the values. Replace the
previous expression with the one that follows:
='Max Value: ' & Max(Aggr(Count(DISTINCT [From - To State Code]),
[Carrier Name])) & Chr(10) &
'Min Value: ' & Min(Aggr(Count(DISTINCT [From - To State Code]),
[Carrier Name])) & Chr(10) &
'Avg Value: ' & Avg(Aggr(Count(DISTINCT [From -
To State Code]), [Carrier Name]))
As you can see from this expression, it gets quite lengthy and the
Count
function is used three times with the same parameters. In this case, it would
be a good idea to apply the expression-in-variable concept described earlier
in this chapter. Once a new
eRoutes
variable is created, the preceding
expression could be changed to the following:
='Max Value: ' & Max(Aggr($(eRoutes), [Carrier Name])) & Chr(10) &
'Min Value: ' & Min(Aggr($(eRoutes), [Carrier Name])) & Chr(10)
&
'Avg Value: ' & Avg(Aggr($(eRoutes), [Carrier Name]))
3.
Click on
OK
to apply the changes and the text object should display
the following: