SUPPORT / SAMPLES & SAS NOTES
 

Support

Usage Note 40007: Understanding solve order in SAS OLAP cubes

DetailsAboutRate It

Solve order specification is defined in MDX Solutions: With Microsoft SQL Server Analysis Services by George Spofford as

A higher number indicates that the member is calculated using the values that result from the calculations that have a lower number.
So, by adjusting the value of the SOLVE_ORDER option in your OLAP calculated members (see DEFINE Statement), you can control the precedence of the calculations.

In some cases, it is important to determine whether the values should be totalled and the calculation applied to that total result, or whether the calculation should be applied to the values, and the results are included in the total. The predefined solve_order for the VisualTotals function is −4096, which is important when determining the order of your calculations.

In the following example, the calculation being performed is <value> + 100000:

WITH 
  MEMBER [Measures].[My Calculation] AS 
         [Measures].[ActualSum] + 100000, SOLVE_ORDER = -5000
SELECT 
  {[Measures].[ActualSum], [Measures].[My Calculation]} ON COLUMNS,
  VISUALTOTALS(ADDPARENTS([Geography].[Country].MEMBERS, POST), "Total *") ON ROWS
FROM 
  [SalesCube]

The calculated measure is executed before the visual totals (−4096), which means that, for every measure, 100000 is added to it and then these values are totaled.

Results with solve order applied

The following query and results demonstrate what happens when solve order is not applied, using the default value of 0 instead.

WITH 
  MEMBER [Measures].[My Calculation] AS 
         [Measures].[ActualSum] + 100000
SELECT 
  {[Measures].[ActualSum], [Measures].[My Calculation]} ON COLUMNS,
  VISUALTOTALS(ADDPARENTS([Geography].[Country].MEMBERS, POST), "Total *") ON ROWS
FROM 
  [SalesCube]

In this case, the measures are totaled first and then the calculated measure is applied to add 100000 to it.

Results without solve order applied

Operating System and Release Information

Product FamilyProductSystemSAS Release
ReportedFixed*
SAS SystemSAS OLAP Serverz/OS9.2 TS2M0
Microsoft® Windows® for 64-Bit Itanium-based Systems9.2 TS2M0
Microsoft Windows Server 2003 Datacenter 64-bit Edition9.2 TS2M0
Microsoft Windows Server 2003 Enterprise 64-bit Edition9.2 TS2M0
Microsoft Windows XP 64-bit Edition9.2 TS2M0
Microsoft® Windows® for x649.2 TS2M0
Microsoft Windows Server 2003 Datacenter Edition9.2 TS2M0
Microsoft Windows Server 2003 Enterprise Edition9.2 TS2M0
Microsoft Windows Server 2003 Standard Edition9.2 TS2M0
Microsoft Windows Server 2003 for x649.2 TS2M0
Microsoft Windows Server 2008 for x649.2 TS2M0
Microsoft Windows XP Professional9.2 TS2M0
Windows Vista9.2 TS2M0
Windows Vista for x649.2 TS2M0
64-bit Enabled AIX9.2 TS2M0
64-bit Enabled HP-UX9.2 TS2M0
64-bit Enabled Solaris9.2 TS2M0
HP-UX IPF9.2 TS2M0
Linux9.2 TS2M0
Linux for x649.2 TS2M0
OpenVMS on HP Integrity9.2 TS2M0
Solaris for x649.2 TS2M0
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.