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
1
890 Views
Last Modified: 2013-11-16
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
  Received
  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
Comment
Question by:tozysentosa
1 Comment
 

Accepted Solution

by:
tozysentosa earned 0 total points
ID: 22783135
Hi,
I found the answer...

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
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.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question