Solved

# How to Roll over End of Month Stock to Beginning Stock of next month in SQL Server 2000 AS

Posted on 2008-10-19
888 Views
Hi Experts,

I have a cube that the has the following

Dimensions
- Time
- Location
- Product
- Transaction Type

Measures
- Qty

The transaction Type dimension classifies all the different transaction codes.
The Sum aggregate at the (ALL) level of the Transaction type dimension is the total changes in inventory for the period, at a location for a product.

I created a Calculated member called BOM (Beginning of Month) with parent dimension 'Transaction Type' and Parent Member '(All)'.
The formula = [Time].prevmember, [Transaction Type].(All)

The BOM rolls the amount at 'all' but the BOM member is not aggregated up to the Transaction Type (All) for the next period.

Period 1
BOM                         <NULL>
Initial Stock Take      100
Sales                         -10
Recieved                     20
Total at (ALL)            110

Period 2
BOM                          110
Sales                         -30
Recieved                     25
Total at (ALL)              -5

Period 3
BOM                            -5
Sales                         -20
Recieved                     15
Total at (ALL)               5

... and so on ...

In the Dimension Browser
Transaction Type
All
Initial Stock Take
Sales
BOM (calculated member)

I assume that Transaction Type dimension at level all will sum all children INCLUDING the calculated member BOM?

Why doesn;t this work?

Anyone can help me?

Period
0
Question by:tozysentosa
1 Comment

Accepted Solution

tozysentosa earned 0 total points
ID: 22783135
Hi,

Create a Calculated member called BOM (Beginning of Month)
with parent dimension 'Transaction Type' and Parent Member '(All)'.
The formula = sum(periodstodate([Time].[(All)], [Time].prevmember),[Transaction type].[(All)])

This sums the total changes from beginning up to previous time member which is equal to the beginning stock of current period.

The formula = sum(periodstodate([Time].[(All)],[Transaction type].[(All)])  gives the Ending stock formula.

0

## Featured Post

### Suggested Solutions

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to shrink a transaction log file down to a reasonable size.