11/22/09

MDX - Open Inventory

WITH
MEMBER [Measures].[Starting Inventory] AS
'
IIF (
IsLeaf (Year.CurrentMember),
[Measures].[Opening Inventory],
([Measures].[Opening Inventory],
OpeningPeriod (
[Year].Levels(0),
[Year].CurrentMember
))
)'

MEMBER [Measures].[Closing Inventory] AS
'
IIF (
Isleaf(Year.CurrentMember),
[Measures].[Ending Inventory],
([Measures].[Closing Inventory],
ClosingPeriod (
[Year].Levels(0),
[Year].CurrentMember
)
)
)'

SELECT
CrossJoin (
{ [100-10] },
{ [Measures].[Starting Inventory], [Measures].[Closing Inventory] }
)
ON COLUMNS,
Hierarchize ( [Year].Members , POST)
ON ROWS
FROM Sample.Basic

returns the grid: