The upcoming release of DevExpress Dashboard includes the ability to use aggregate functions when constructing calculated field expressions. As you know, aggregate functions perform calculations on a set of values and return a single value. This allows you to pre-aggregate data source field values in a calculated field expression. The resulting calculated field is similar to a measure in multi-dimensional data sources such as OLAP cubes.
You can use any of the following predefined aggregate functions within the Dashboard Designer...
- Avg() - Returns the average of all values in the expression.
- Count() - Returns the number of values.
- CountDistinct() - Returns the number of distinct values.
- Max() - Returns the maximum value across all records.
- Min() - Returns the minimum value across all records.
- Sum() - Returns the sum of all values.
Let's quickly review how you can create a calculated field...Step 1 is to add a new field using the Field List's context menu.
In step 2, you must construct the expression using the DevExpress Expression Editor - In this example, we'll navigate to Aggregate Functions and construct the following expression: Sum([Profit]) / Sum([Revenue])
Once the expression is complete, you can rename the calculated field. In our example, we'll rename it to Margin.
At this point, you can simply drag and drop the new field to the desired Dashboard item. In the following example, we use Dashboard Cards to visualize the data..
.
So what do you think - how likely are you to use this new feature? We'd love to hear your thoughts.