INF: How to Carry Balances Forward for Display in a Balance Sheet. (307945)



The information in this article applies to:

  • Microsoft SQL Server 2000 Analysis Services

This article was previously published under Q307945

SUMMARY

Balance Sheets are a common means of reporting cumulative financial data for a distinct time period. This article explains how to use calculated members to provide the necessary functionality.

MORE INFORMATION

NOTE: This example uses the Sales cube of the FoodMart 2000 sample.

Launch the MDX Sample Application, connect to the OLAP Server, select the FoodMart sample database, and execute the following MDX query:
SELECT {[STORE].[ALL STORES].[USA]} ON COLUMNS,
   MEASURES.ALLMEMBERS ON ROWS
   FROM SALES
				
The values returned are as follows:

USA
Unit Sales266,733.00
Store Cost225,627.23
Store Sales$565,238.13
Sales Count86837
Store Sales NET339,610.90
Profit339,610.90
Sales Average6.51

The values returned from the query are summed values, and do not reflect the most recent value (which would be the desired result in a balance sheet). To return the most recent values for the USA member for calendar year 1997, execute the following MDX query:
SELECT {[STORE].[ALL STORES].[USA]} ON COLUMNS,
   MEASURES.ALLMEMBERS ON ROWS
   FROM SALES
   WHERE (TIME.[1997].[Q4].[12])
				
The values returned by this query are as follows:

USA
Unit Sales26,736.00
Store Cost22,746,13
Store Sales$56,965.64
Sales Count8717
Store Sales NET34,219.51
Profit34,219.51
Sales Average6.54

These values are the most recent values for the time period in question, and would be the desired result for a balance sheet.

To present cumulative balance values in the manner typically expected on a balance sheet, follow these steps:
  1. Open the Time dimension for editing and set the All Level property of the time dimension to NO. (If the All Level property is set to YES, the values of the children are automatically rolled up and summed.)
  2. Create a calculated cell named "Yearly Balances" with the following characteristics:

    PropertyValue
    Calculation SubCube[Time].[Year].MEMBERS
    Calculation ConditionApplies to entire calculation subcube.
    Calculation ValueIIF(IsEmpty(Time.CurrentMember.Children(3)), IIF(IsEmpty(Time.CurrentMember.Children(2)), IIF(isEmpty(Time.CurrentMember.Children(1)), IIF(IsEmpty(Time.CurrentMember.Children(0)), null,Time.CurrentMember.Children(0)), Time.CurrentMember.Children(1)), Time.CurrentMember.Children(2)), time.currentmember.children(3))
  3. Create a second calculated cell named "Quarterly Balances" with the following characteristics:

    PropertyValue
    Calculation SubCube[Time].[Quarter].MEMBERS
    Calculation ConditionApplies to entire calculation subcube.
    Calculation ValueIIF(IsEmpty(Time.CurrentMember.Children(2)), IIF(isEmpty(Time.CurrentMember.Children(1)), IIF(IsEmpty(Time.CurrentMember.Children(0)), null,Time.CurrentMember.Children(0)), Time.CurrentMember.Children(1)), Time.CurrentMember.Children(2))
Launch the MDX Sample Application, connect to the OLAP Server, select the modified FoodMart 2000 sample database, and execute the following MDX query:
SELECT {[STORE].[ALL STORES].[USA]} ON COLUMNS,
   MEASURES.ALLMEMBERS ON ROWS
   FROM SALES
				
The values returned by the query, after adding the two calculated cells, are as follows:

USA
Unit Sales26,736.00
Store Cost22,746,13
Store Sales$56,965.64
Sales Count8717
Store Sales NET34,219.51
Profit34,219.51
Sales Average6.54

These values are the most recent values for the time period in question, and represent the desired result for a balance sheet.

Modification Type:MinorLast Reviewed:7/16/2004
Keywords:kbinfo KB307945