Image may be NSFW.
Clik here to view. Microsoft SQL Server Analysis Services is one of the leading OLAP server available in the market. Its often SSAS developers are required to provide trailing monthly, quarterly or year Sales or any measure trend analysis. There are many ways to perform Trend analysis, but I like this very simple and basic approach for getting trailing trend analysis.
There is a very simple and straight forward function in MDX “TAIL“. The Tail function returns the specified number of tuples from
the end of the specified set. The order of elements is preserved. The default value of Count is 1. If the specified number of tuples is less than 1, the function returns the empty set. If the specified number of tuples exceeds the number of tuples in the set, the function returns the original set.
SSAS Function | |
Function Name: | Tail |
Category: | Set |
Description: | The Tail function returns the last specified number of members from the supplied set. |
Syntax: | TAIL( «Set»[, «Count»] ) |
A very basic MDX to find out Trailing 13 months Sales would be
Select
Tail(Time.[Time Hierarchy].[Month], 12) on Rows,
{Measures.[Product Sales]} on Columns
From AbcSalesCube
The best way to show this trend in the Line graph as shown in the picture above. You may also show Actual Sales Vs Targeted Sales to get more inference in the report