Skip to content

This example shows how to display sales by years in comparison with the previous year's sales.

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/win-dashboard-display-previous-year-sales

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dashboard for WinForms - How to display sales by years in comparison with the previous year's sales

This example shows how to display sales by years in comparison with the previous year's sales.

Example Structure

The Previous Year Sales Grid displays sales by year in comparison with the previous year’s sales. The PrevYearSales field is calculated by the following expression:

aggr(Sum([Sales]), joinRule(GetYear([OrderDate]),GetYear([OrderDate])-1))

The joinRule function here is used to shift the calculated sales back a year. Add the created field to the Grid’s Columns section to see the result:

screenshot

The second Grid, Product Sales by Quarters, displays quarterly sales numbers in comparison with corresponding quarterly numbers from the previous year.

The PrevQuarterYearSales calculated field aggregates sales by products and the previous year’s quarter. The joinRule function is used to calculate the second dimension.

aggr(Sum([Sales]),[ProductName],joinRule(GetDateQuarterYear([OrderDate]),GetDateQuarterYear(AddYears([OrderDate], -1))))

A format rule is applied to highlight sales that declined in comparison to the previous year:

screenshot

Files to Review

Documentation

More Examples

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)