TREND Function

The TREND function uses the least squares method to extrapolate values based on a linear trend.

TREND(index_of_column_ to_return, index_of_column_to_look_up, value_to_look_up, BQL_query)

For example, to get the linear trend of quantity over a period of time:

TREND(1,0,[Time.Month Seq Number], SELECT [Time.Month Seq Number], [Order_Date: Sum: Quantity]FROM [ALL] WHERE [Time.Month Seq Number] >= 1330 AND [Time.Month Seq Number] <= 1342)

The query for the Visualizer report from Advanced Tools > Advanced Tools > Queries:

SELECT TOP 100 USING OUTER JOIN TREND(1,0,[Time.Month Seq Number], SELECT [Time.Month Seq Number], [Order_Date: Sum: Quantity] FROM [ALL] WHERE [Time.Month Seq Number] >= 1330 AND [Time.Month Seq Number] <= 1342) 'COL0' , [Order_Date: Sum: Quantity] 'COL1' , [Time.Month Seq Number] 'COL2' FROM [ALL] WHERE ( ( [Time.Month Seq Number]>=1330 AND [Time.Month Seq Number]<=1342 ) )

The Visualizer report:

Visualizer Report Example for TREND