**D****escription:**

Calculation utilizes 2 Parameters and an LoD to compute the Sales for the First N Periods. Both N and Periods are adjustable via Parameters.

In addition the Calc uses { INCLUDE : } as opposed to FIXED, so that the Dimensions can added, or rotated at will

**Example Calculation:**

Period Parameter =>

First N Periods = >

Sales of First N Periods =>

IF DATEDIFF([Period], { INCLUDE : MIN([Order Date]) }, [Order Date])

< [First N Periods]

THEN [Sales]

END

Additional Note*

This can also be expanded by adding a First/Last parameter to control whether or not the User wants to See the First/Last N Period Sales by Dimension

IIF([First/Last] = 'First',

IF DATEDIFF([Period], { INCLUDE : MIN([Order Date])}, [Order Date])

< [N Periods]

THEN [Sales]

END

,

IF DATEDIFF([Period], [Order Date], { INCLUDE : MAX([Order Date]) })

< [N Periods]

THEN [Sales]

END

)

## Comments