# DevExpress Dashboard - Advanced Data Analysis using Window Calculations and Intermediate Aggregation (Coming soon in v16.1)

08 June 2016

I think we can all agree that an Analytics Platform like DevExpress Dashboard must effectively address 2 key areas:

• Provide Data Visualizations that are clear, concise and configurable (it goes without saying that they must also be easy to understand).
• Offer Data Preparation tools so users can mine data and answer a variety of business "questions" with minimal effort.
In this post, I'll describe 2 features that are aimed at improving data prep for your visualizations - Enhancements which go a long way to increasing productivity when using our Dashboard.

Window Calculations

To more easily display Moving Averages, Running Totals, Total Percentage, Parallel Periods, rank, etc, v16.1 includes a powerful set of pre-built window calculations.

Each calculation is represented by a special "window" expression. To explain what this means, let's take a look at a couple of examples:

Moving Averages

WindowAvg(Sum(Sales), -30, 0)

As you can see in the image below, this expression calculates a moving average for 30 points within the sales chart:

Running Totals

The following expressions calculate the cumulative sum of revenue and expense along a time axis:

RunningSum(Sum(Revenue))
RunningSum(Sum(Expenses))

It goes without saying that Window Calculations simplify data prep when using DevExpress Dashboard. If you encounter situations that require you to combine multiple groupings of data in a single expression (such as the best product by sales for a specific year), you'll need another new feature inside DevExpress Dashboard - Intermediate Aggregation.

Intermediate Aggregation

DevExpress Dashboard v16.1 ships with a new "Aggr" function (with straightforward syntax). The function temporarily groups raw data by a set of dimensions and calculates a summary expression:

Aggr( summaryExpression [, dimension1, dimension2, ...] )
The function itself can be used in a calculated field expression and freely combined with any other calculated field functions. To best explain the value of Intermediate Aggregation, let's take a quick look at a couple of everyday business scenarios:

QUESTION: What are the best and worst selling products products in a particular year?

...To answer the question above, we'd first have to apply multiple aggregations to our data:

Yearly_Sales_by_Product = Aggr(Sum(Sales), Product, GetYear(Date) )
Max_Yearly_Sales = Aggr(Max(Yearly_Sales_by_Product), GetYear(Date))
Min_Yearly_Sales = Aggr(Min(Yearly_Sales_by_Product), GetYear(Date))

Then determine the names of the best and worst products:

Best_Product = Iif(Yearly_Sales_by_Product = Max_Yearly_Sales, Product, null)
Worst_Product = Iif(Yearly_Sales_by_Product = Min_Yearly_Sales, Product, null)

If we were to use the Dashboard's Grid to present the results to end-users, the final step would require that we add both a "Best Product" and "Worst Product" calculated field to the Grid as measures.

QUESTION: How many days per month are profitable?

Unlike the previous example (where we treated the resulting aggregations as measures in a Grid), the following displays the appropriate aggregation as a dimension within a chart.

To mark specific days as either profitable or unprofitable, we need to perform the following aggregation by Date:

Sales_Marker = Iif(Sum(Sales) >= Sum(TargetSales), 'Profitable Days', 'Unprofitable Days')
Days_Marker = Aggr(Sales_Marker, Date)
Once complete, we must calculate the day count, and for purposes of this example, treat unprofitable days as negative:

Days_Count = Iif(Min(Days_Marker) = 'Profitable Days', CountDistinct(Date), -CountDistinct(Date))
To present results within a Dashboard Chart, we'll use the "Days_Count" field as a value and the "Days_Marker" field as a series dimension:

Hopefully this summary helped illustrate the value of both Window Calculations and Intermediate Aggregations and how we've improved the analytical capabilities of the DevExpress Dashboard for .NET.

For existing Dashboard users - all functions are available in both data binding modes: via a direct connection to a dat base (server-mode) and when using our in-memory data processing engine(client-mode).

We'd love to hear your thoughts on these 2 new features and learn more about how you're using DevExpress Dashboard within your enterprise.

## Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
Tags