0
votes

I'm modelling a cube that contains inventory data. For simplicity's sake we are trying to maintain one date dimension. Some of these measures contain the stock level.

The end users are using Excel to view data from analysis services. What I want to do is stop this dimension from showing values where the actual stock transactions end.

There are other measures in the cube that require future information, so removing all date entries in the future is not allowed.

A simplified example measure:

CREATE [Measures].[Quantity On Hand];
SCOPE ([Measures].[Quantity On Hand]); 
    this = Aggregate(null:[Transaction Date].[Year - Quarter - Month].CurrentMember,  [Measures].[Quantity Purchased])
            - Aggregate(null:[Transaction Date].[Year - Quarter - Month].CurrentMember,  [Measures].[Quantity Sold]) 
    FORMAT_STRING(this) = "#,#.00;-#,#.00; ";
END SCOPE;

The date dimension contains future dates.

Can I make the [Transaction Date] dimension stop showing information after the last transaction in this measure (Highest Transaction Date in the fact table)?

1

1 Answers

1
votes

You should be able to use the CLOSINGPERIOD(Dim,Measure) function. It will display the last member on the time dimension where the Measure is used. In your case, the last entry for either Quantity Purhased or Quantity Sold. Use this as a check to not calculate for future dates.

Also, if you -never- load any future dates, you can also use "today" as the check for not loading future dates: StrToMember("[Time].[Day].&[" + Format(Now(), "yyyyMMdd") + "]") - where yyyyMMdd is the format you use on day levels.