SAS® Financial Management 5.5 Formula Guide
SAS® Financial Management 5.5 Formula Guide
Management 5.5
Formula Guide
The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2015. SAS® Financial
Management 5.5: Formula Guide. Cary, NC: SAS Institute Inc.
SAS® Financial Management 5.5: Formula Guide
Copyright © 2015, SAS Institute Inc., Cary, NC, USA
All rights reserved. Produced in the United States of America.
For a hard-copy book: No part of this publication may be reproduced, stored in a retrieval system, or
transmitted, in any form or by any means, electronic, mechanical, photocopying, or otherwise, without the prior
written permission of the publisher, SAS Institute Inc.
For a web download or e-book: Your use of this publication shall be governed by the terms established by the
vendor at the time you acquire this publication.
The scanning, uploading, and distribution of this book via the Internet or any other means without the permission
of the publisher is illegal and punishable by law. Please purchase only authorized electronic editions and do not
participate in or encourage electronic piracy of copyrighted materials. Your support of others’ rights is
appreciated.
U.S. Government License Rights; Restricted Rights: The Software and its documentation is commercial
computer software developed at private expense and is provided with RESTRICTED RIGHTS to the United
States Government. Use, duplication or disclosure of the Software by the United States Government is subject
to the license terms of this Agreement pursuant to, as applicable, FAR 12.212, DFAR 227.7202-1(a), DFAR
227.7202-3(a) and DFAR 227.7202-4 and, to the extent required under U.S. federal law, the minimum restricted
rights as set out in FAR 52.227-19 (DEC 2007). If FAR 52.227-19 is applicable, this provision serves as notice
under clause (c) thereof and no other notice is required to be affixed to the Software or documentation. The
Government's rights in Software and documentation shall be only those set forth in this Agreement.
SAS Institute Inc., SAS Campus Drive, Cary, North Carolina 27513-2414.
January 2015
SAS provides a complete selection of books and electronic products to help customers use SAS® software
to its fullest potential. For more information about our offerings, visit sas.com/store/books or call
1-800-727-0025.
SAS® and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS
Institute Inc. in the USA and other countries. ® indicates USA registration.
Other brand and product names are trademarks of their respective companies.
iii
Contents
Chapter 1 Introduction 1
Included in This Document 1
Additional Documentation 1
Example Data 1
Chapter 2 Formula Types 7
Overview of Formula Types and Formulas 7
Reporting Formulas and Excel-Based Calculated Members 8
Introduction 8
Calculation Method 8
Currency Conversion Method 8
Fact Storage 8
Treatment of NaNs 9
Dimension Type 9
Reuse 9
Choosing Whether to Use a Reporting Formula or an Excel-Based Calculated Member 9
Driver and Modeling Formulas 10
Introduction 10
Calculation Method 10
Currency Conversion Method 10
Fact Storage 10
Treatment of NaNs 10
Dimension Type 11
Reuse 11
Choosing Whether to Use a Driver Formula or a Modeling Formula 11
Chapter 3 Formula Computation 13
Order of Execution 13
Introduction 13
Formulas 14
Facts 14
Rates 14
Results 15
Functional Currency Approach 17
Introduction 17
Four Steps 17
Formula 17
Facts 17
Rates 18
Reporting Currency Approach 20
iv Contents
Formula 20
Facts 20
Rates 20
Chapter 4 Formula Basics for Server-Side Calculated Members 23
Introduction 23
Creating a Server-Side Calculated Member 23
Adding Formulas to a Member 38
Removing Formulas from a Member 40
Editing a Calculated Member 42
Account Types for Calculated Members 43
Resolving Conflicts between Dimensions 43
Introduction 43
Scenario 1. Account Dimension Has Higher Rank than Analysis Dimension 45
Scenario 2. Analysis Dimension Has Higher Rank than Account Dimension 46
Virtual Child Members 47
Viewing Formula Information in SAS Financial Management Studio 47
Viewing Formula Information in Excel 50
Chapter 5 Formula Basics for Excel-Based Calculated Members 55
Introduction 56
Creating an Excel-Based Calculated Member 56
Removing an Excel-Based Calculated Member 61
Editing an Excel-Based Calculated Member 62
Viewing Formula Information for Excel-Based Calculated Members 65
Pivoting an Excel-Based Calculated Member 65
Resolving Conflicts between Excel-Based Calculated Members 67
Introduction 67
Excel-Based Calculated Member Expressions 67
Results 67
Examples of Excel-Based Calculated Member Formulas 69
Introduction 69
fmValue Function 69
fmCode Function 69
fmProperty Function 70
fmRate Function 72
fmXRate Function 73
fmCXRate Function 74
Absolute References to Cells in the Same Workbook 78
Using Any Excel Function or Valid Excel Expression 79
Excel-Based Calculated Members and Display Styles 80
Formulas That Run Out of Bounds 83
Excel-Based Calculated Members on the Web 84
Differences between Calculated Members in Excel and on the Web 84
Excel-Based Calculated Members and Supplemental Tables 84
Contents v
Description 118
Affected Formula Types 118
Example 118
Results 119
Warning Messages 119
Circular References 120
Description 120
Affected Formula Types 120
Example 120
Results 121
Warning Message for Excel 121
Dividing by Zero 122
Description 122
Affected Formula Types 122
Example 122
Results 123
Warning Message for Excel 123
Recommendation 124
Chapter 8 Statistical Account Behavior 125
Introduction 125
Statistical Accounts for Data Entry 126
Introduction 126
Facts 126
Hierarchical Roll-Ups 126
Time Aggregation 127
Frequency Computation 128
Data Entry 129
Calculated Statistical Accounts 129
Introduction 129
Formula 129
Facts 130
Hierarchical Roll-Ups 130
Frequency Computation 131
Restrictions 131
Chapter 9 Commonly Used Functions 133
ANCESTOR Function 134
Use 134
Syntax 135
Example 135
CLOSINGPERIOD Function 136
Use 136
Syntax 136
Example 136
Contents vii
Syntax 152
Example 152
VIRTUALCHILD Function 154
Use 154
Syntax 155
Example 155
Adding Comments within a Formula Expression 155
Using String Functions in a Bracketed Member Reference 155
Using Dates and Numbers in Formula Syntax 156
Codes Containing Single and Double Quotation Marks 156
Chapter 10 Interactions with Load and Delete Data Options 157
Options for Loading Data 157
Introduction 157
Load new data to this cycle Option 158
Load model data to this cycle Option 158
Loading Data and the Source Dimension 158
Scenario 1. Selecting the Base Source Member 159
Scenario 2. Selecting the BaseForm Source Member 163
Loading Driver Formulas Facts to the Base Member of the Source Dimension 165
Deleting Data and Driver Facts 165
Chapter 11 Using Driver Formulas 167
Introduction 167
Range of Execution 167
What Triggers Execution of a Driver Formula 168
Two Actions 168
Driver Formulas That Are Triggered by Data Entry on a Form 168
Driver Formulas That Are Triggered by the Run driver formulas for this form set Option
169
Form Design 169
Form Design Restrictions 169
Delete Behavior with Run Driver Formulas for this Form Set Option 170
Number of Driver Formulas in a Model 170
Chapter 12 Optimizing Formula Performance 171
Overview 171
Comparing the Execution of Driver Formulas and Modeling Formulas 171
Managing Formulas for Performance 173
Introduction 173
Using CubeFormulasInfo and QueryStats Logging 177
Applying Performance Improvements 177
Introduction 178
Example 1 178
Example 2 181
Contents ix
1
C H A P T E R
Introduction
Additional Documentation
For additional information about using the SAS Financial Management clients (SAS
Financial Management Studio, SAS Financial Management Add-In for Microsoft Excel
and the web-based Financial Form Manager software), refer to SAS Financial
Management: Process Administrator’s Guide or the online Help for each client.
Example Data
The examples provided in this document were performed using SAS Financial
Management 5.5. The query results are displayed in the SAS Financial Management
Add-In for Microsoft Excel and through web-based data entry tables.
The examples use a standard set of dimensions, hierarchies, and members.
2 Example Data Chapter 1
ORGANIZATION
Worldwide Operations
U.S. Operations
Sales
Central
Eastern
Western
Administration
Corporate Comm
Facilities
Human Resources
Finance
Accounting
Corporate Legal
Payroll
Purchasing
Product Delivery
Telemarketing
Technology
Information Systems
Publications
Quality Assurance
Research
Technical Support
European Operations
European Sales
Admin Europe
HR Europe
IT Support - Europe
Canada Operations
Canada Sales
Admin Canada
HR Canada
IT Support - Canada
Mexico Operations
Mexico Sales
Admin Mexico
HR Mexico
IT Support - Mexico
Introduction Example Data 3
ACCOUNT
Net Income
Income Tax
Income before Taxes
Operating Expense
Administrative Expense
Office Supplies
Postage
Other Administrative Expenses
Facilities
Rent
Electric
Water
Repairs & Maintenance
Telecom
I/S Expenses
Other Facilities Expenses
Marketing Expense
Advertising
Promotions
Other Marketing Expenses
Selling Expense
Staff Expenses
Salaries
Benefits
Travel
Other Selling Expenses
Other Operating Expense
Gross Profit
Sales
Cost of Sales
Balance Sheet
Assets
Cash and Cash Equivalents
Net Accounts Receivable
Accounts & Notes Receivable
Allowance for Doubtful Accounts
Inventory
Investment in Subs
Liabilities
Accounts Payable
Notes Payable
Other Accrued Liabilities
Stockholder’s Equity
Common Stock
Additional Paid-in Capital
Retained Earnings
Pr Year Retained Earnings
Cumulative Translation Adjustment
4 Example Data Chapter 1
Ending Headcount
Units Sold
ANALYSIS
Actual
Budget
Forecast
CURRENCY
USD
CAD
EUR
MXN
PRODUCT
Product Total
Video Games
Action
Simulation
Arcade
Puzzle
Hardware
Game Controller
Joy Stick
Flight Stick
Publications
How to Use Simulator
Arcade Secrets
Puzzle Tricks
CUSTOMER
Customer Total
Partner
HAL
Accents
Grand Hampton
Direct
Buy Best
SW Mart
Radio City
Resellers
Jones Distributing
Westco
Government
DOD
Civilian
State & Local
Introduction Example Data 5
TIME
All Years
2012
Q1 2012
Jan 2012
Feb 2012
Mar 2012
Q2 2012
Apr 2012
May 2012
Jun 2012
Q3 2012
Jul 2012
Aug 2012
Sep 2012
Q4 2012
Oct 2012
Nov 2012
Dec 2012
2013
Q1 2013
Jan 2013
Feb 2013
Mar 2013
Q2 2013
Apr 2013
May 2013
Jun 2013
Q3 2013
Jul 2013
Aug 2013
Sep 2013
Q4 2013
Oct 2013
Nov 2013
Dec 2013
6 Example Data Chapter 1
7
2
C H A P T E R
Formula Types
fact storage
treatment of NaNs (Not a Number)
dimension type
reuse
The following sections describe the various formula types and their properties.
Introduction
Reporting formulas and Excel-based calculated members are generally recommended
for ratios and other values that do not need to be aggregated, such as key performance
indicators.
Calculation Method
Reporting formulas and Excel-based calculated members run at each member in a
hierarchy and do not distinguish between leaf members and roll-up points. The following
illustrates their calculation behavior:
Fact Storage
Results for reporting formulas and Excel-based calculated members are computed at
the time of a query. Their values are not stored in the database, but are generated on an
as-needed basis.
Formula Types Reporting Formulas and Excel-Based Calculated Members 9
Treatment of NaNs
Invalid Reporting and Excel-based calculated member formula expressions result in a
NaN (Not a Number) on a table when queried. For these two formula types, a calculated
member that results in a NaN returns a red cell. Cell Information provides a message
explaining why the query for a particular crossing failed. Examples of invalid formula
expressions and calculated member restrictions are discussed further in Chapter 7,
“Calculated Members Restrictions.”
Dimension Type
Reporting and Excel-based calculated members can be created for the following
dimension types:
Account
IntOrg
Analysis
Custom
Reuse
Reporting formulas are centrally managed in the Dimensions workspace of SAS
Financial Management Studio. Given appropriate security, reporting formula calculated
members are available to many users because they are server-side calculations. As a
result, the formula is considered reusable.
Excel-based calculated members are created and maintained in the Excel Add-In
client. Because they are not server-side calculations, they are not considered reusable.
They are available on a table-by-table basis only.
Introduction
Driver formulas and modeling formulas are typically associated with calculations
used in the budgeting and forecasting process. Examples include Estimated Sales based
on Price and Units, Benefits Expense based on Salaries & Wages, and Training Expense
based on Ending Headcount.
Calculation Method
Driver formulas and modeling formulas run at leaf members, and results are summed
at roll-up points. The following illustrates their calculation behavior:
Fact Storage
Results for driver formulas are stored in the database as facts for the BaseForm
member of the Source dimension. Results for modeling formulas are computed as needed
at the time of a query. They are not stored in the database.
Treatment of NaNs
For invalid formula expressions on driver and modeling formula types, query results
and available Cell Information differ significantly. Modeling formulas perform similarly
to reporting formulas and Excel-based calculated members in that the crossing displays
a red cell and Cell Information provides a message explaining why the query for a
particular crossing failed.
To minimize the number of NaN facts generated and stored for Driver formulas, the
query results for a driver formula type with an invalid formula expression return gray,
Formula Types Driver and Modeling Formulas 11
non-writeable cells with a value of zero displayed. Also, Cell Information says that the
query succeeded.
Dimension Type
Driver formulas and modeling formulas are available only in the Account dimension.
Reuse
Driver formulas and modeling formulas are centrally managed in the Dimensions
workspace of SAS Financial Management Studio. Given appropriate security, these
calculated members are available to many users because they are server-side
calculations. As a result, driver and modeling formula types are considered reusable.
3
C H A P T E R
Formula Computation
Order of Execution
Introduction
The order of execution is as follows:
1 Facts
2 Intercompany eliminations
3 Driver formulas
4 Modeling formulas
5 Retained Earnings and Cumulative Translation Adjustment accounts
6 Reporting formulas
This execution order allows both modeling formulas and driver formulas to be
indirectly referenced or directly referenced as source accounts of Retained Earnings
accounts and Cumulative Translation Adjustment accounts. Reporting formulas are
calculated after Retained Earnings accounts and Cumulative Translation Adjustment
accounts. Therefore, reporting formulas do not contribute to the results of Retained
Earnings accounts and Cumulative Translation Adjustment accounts.
Simply stated, each level can consume its own level as well as the level(s) before it.
Note that currency conversion occurs at each level of execution.
14 Order of Execution Chapter 3
Formulas
Reporting Formula (RF):
Training Expense - RF = ["ACCOUNT"="Ending Headcount"]*200
Modeling Formula (MF):
Training Expense - MF = ["ACCOUNT"="Ending Headcount"]*300
Driver Formula (DF):
Training Expense - DF = ["ACCOUNT"="Ending Headcount"]*400
Excel-based Calculated Member (XB):
Training Expense - XB =fmValue("Ending Headcount")*500
Facts
The following PTD facts have no currency assigned (NONE) for Ending Headcount.
The Ending Headcount is a Statistical Balance account type.
Jan 2013 2.0
Feb 2013 2.5
Mar 2013 3.0
Rates
The following Period Average rates apply for currency conversion from CAD to USD:
Jan 2013 0.90
Feb 2013 0.91
Mar 2013 0.92
The following Period Close rates apply for currency conversion from CAD to USD:
Jan 2013 0.895
Feb 2013 0.905
Mar 2013 0.915
Formula Computation Order of Execution 15
Results
In CAD, the results are displayed as follows:
Introduction
In versions prior to SAS Financial Management 4.4, all formula results were
computed using the currency and frequency as specified in the table. Beginning with
SAS Financial Management 4.4, only reporting formulas and Excel-based calculated
members continue to use this currency conversion method. Modeling formulas and
driver formulas now use the functional currency approach. Modeling formula and driver
formula calculations always take place in the functional currency of the IntOrg member.
The results are then converted to the reporting currency, which might or might not be
the same as the functional currency. The reporting currency is the currency that is
specified in the table, either explicitly or through the table default read member.
Four Steps
The functional currency approach has four steps to accurately calculate and currency
convert modeling formulas and driver formulas:
Step 1: Convert data input(s) to the functional currency using the PTD frequency.
Step 2: Solve for the calculated member in the functional currency using the PTD
frequency.
Step 3: Solve for the Period Activity frequency in the functional currency based on
the PTD results that are derived in Step Two.
Step 4: Convert results to the reporting currency and frequency as specified in the
table based on the Period Activity results that are derived in Step Three.
Note: Any constants are considered to be in the functional currency of the IntOrg
member that they were entered on.
To illustrate these four steps, we use the following example with a driver formula.
The formula, facts, rates, and results are given below.
Formula
Driver Formula:
Allowance for Doubtful Accounts = ["ACCOUNT"="Accounts & Notes
Receivable"]*["ACCOUNT"="Doubtful Accounts %"]
Facts
The following PTD facts are in USD for Accounts Receivable—a balance account type.
The facts are not in the functional currency of the Admin Canada organization member.
Dec 2012 100
Jan 2013 200
Feb 2013 250
Mar 2013 400
18 Functional Currency Approach Chapter 3
Rates
The following Period Close rates apply for currency conversion from EUR to USD:
Dec 2012 0.76
Jan 2013 0.77
Feb 2013 0.78
Mar 2013 0.79
Step 1
Convert data input(s) to the functional currency using the PTD frequency.
Step 2
Solve for the calculated member in the functional currency using the PTD frequency.
Formula Computation Functional Currency Approach 19
Step 3
Solve for the Period Activity frequency in the functional currency based on the PTD
results that are derived in Step 2.
Step 4
Convert results to the reporting currency and frequency as specified in the table based
on the Period Activity results that are derived in Step 3.
20 Reporting Currency Approach Chapter 3
Formula
Reporting Formula:
Gross Margin Percentage = ["ACCOUNT"="Gross Margin”]/ ["ACCOUNT"="Sales”]
Facts
The following table displays the facts for Sales and Cost of Sales, which are both flow
account types. The facts were entered in CAD, which is the functional currency for the
Canada Sales organization member.
Rates
The following Period Average rates apply for currency conversion from CAD to USD:
Dec 2012 0.89
Jan 2013 0.90
Feb 2013 0.91
Mar 2013 0.92
Formula Computation Reporting Currency Approach 21
Step 1
Convert data input(s) to the currency and frequency as specified in the table.
Step 2
Solve for the calculated member in the currency and frequency as specified in the
table.
22 Reporting Currency Approach Chapter 3
23
4
C H A P T E R
Introduction ................................................................................................................................................. 23
Creating a Server-Side Calculated Member ............................................................................................... 23
Adding Formulas to a Member ................................................................................................................... 38
Removing Formulas from a Member ........................................................................................................... 40
Editing a Calculated Member ..................................................................................................................... 42
Account Types for Calculated Members ...................................................................................................... 43
Resolving Conflicts between Dimensions .................................................................................................... 43
Introduction.......................................................................................................................................... 43
Scenario 1. Account Dimension Has Higher Rank than Analysis Dimension .................................... 45
Scenario 2. Analysis Dimension Has Higher Rank than Account Dimension .................................... 46
Virtual Child Members ................................................................................................................................ 47
Viewing Formula Information in SAS Financial Management Studio ..................................................... 47
Viewing Formula Information in Excel ...................................................................................................... 50
Introduction
This chapter covers the fundamentals for server-side formula creation and
management as well as other relevant information.
To create a new member in the Account dimension, click Add a member to this
hierarchy on the Hierarchies tab or Create a new member on the Members tab
(shown below).
2. After completing the required member property information, select the desired
formula type and click Next.
The Edit Expressions window has three tabs for creating and managing formula
expressions:
The Functions tab provides a comprehensive list of functions that are
available in SAS Financial Management.
The Members tab is the default tab that is displayed when opening the
Formula Editor window. It provides the current hierarchical view of members
based on the selected dimension and hierarchy.
The Driver Rate Types tab offers a separate workspace for selecting rates.
The two options return identical results. The only difference is in the setup and
maintenance of the formula expression.
30 Creating a Server-Side Calculated Member Chapter 4
7. To use fixed members, select the Assign fixed members check box.
The member selected is displayed on the Expression tab. For more information
about the use of fixed members with calculated members, see Chapter 6,
32 Creating a Server-Side Calculated Member Chapter 4
13. To use the scope functionality, select the Limit the calculation range check box.
14. Similar to fixed members, click the green plus icon to select members or properties
for scoping.
For member scoping, select the desired dimension type, dimension, and hierarchy.
Members are displayed in the context of the current view of the selected
dimension and hierarchy. You can select from the available hierarchies and choose
multiple members in each dimension.
Formula Basics for Server-Side Calculated Members Creating a Server-Side Calculated Member 35
15. Highlight the desired member(s) and select the desired Member Selection Rule
associated with the member as well as whether to apply to the virtual children.
19. Click Add and Close to see the summary of member and property scoping on the
Scope tab.
Formula Basics for Server-Side Calculated Members Creating a Server-Side Calculated Member 37
A summary window shows the expression text, fixed members, member, and
property scope of the formula that you have created.
This completes the creation of a single formula on a member. At this point, you have
not yet completed all the required steps for the addition of the calculated member. You
are returned to the Formulas page. On the Formulas page, you can create additional
formulas, edit existing formulas, or view the properties of existing formulas.
Repeat steps 3 (page 25) through 20 to create multiple formulas on the same member.
38 Adding Formulas to a Member Chapter 4
See steps 3 (page 25) through 20 in the preceding section for detailed information
about creating formulas.
40 Removing Formulas from a Member Chapter 4
3. Highlight the formulas that you want to remove and click the Delete icon.
When you click the Delete icon, the formula expression(s) is removed. However, the
deletion is not final until you click OK. If you click Cancel, then no changes are saved,
and the formulas are not deleted. If you click OK, then changes are saved and the
formula expressions are gone.
Note: If you delete a driver formula for which results have been computed and stored,
the stored results are not deleted. To delete the stored results, select the Run driver
formulas for this form set option for the appropriate form set.
42 Editing a Calculated Member Chapter 4
Detailed steps for editing these properties are in the first section of this chapter. As
with all properties, changes to formula-related properties are subject to versioning. A
hierarchy that has a time/date stamp that is earlier than the time when a certain
change was made to the formula still uses the formula as it was before the change.
Formula Basics for Server-Side Calculated Members Resolving Conflicts between Dimensions 43
Introduction
Formula conflicts are limited to reporting formulas. Due to execution order, driver
formulas and modeling formulas always run before reporting formulas and are available
only in the Account dimension. Since only the Account dimension allows driver formulas
and modeling formulas, there are never any conflicts with these formula types.
44 Resolving Conflicts between Dimensions Chapter 4
However, a model with reporting formulas in more than one dimension can have
crossings that have two or more formulas associated with them. In such a case, the
formula rank determines which formula runs at the crossing. The rank is managed
through Model Properties on the Formulas page, as shown here:
To illustrate formula rank, consider the following two reporting formula expressions:
Account dimension: Sales = ["ACCOUNT"="Price"]*["ACCOUNT"="Units"]*-1
Analysis dimension: Variance = ["ANALYSIS"="Budget"]-["ANALYSIS"="Actual"]
We follow a scenario for each expression:
“Scenario 1: Account Dimension Has Higher Rank than Analysis Dimension”
“Scenario 2: Analysis Dimension Has Higher Rank than Account Dimension”
Formula Basics for Server-Side Calculated Members Resolving Conflicts between Dimensions 45
With the Account dimension ranked first, Variance for Sales is computed as
0 * 20 * -1 = 0.
1. At the crossing for the Sales Account and Variance Analysis members, select
Tools Cell Information to view the following message:
46 Resolving Conflicts between Dimensions Chapter 4
With the Analysis dimension ranked first, Variance for Sales is computed as
(21,000.00) - (20,000.00) = (1,000.00).
Formula Basics for Server-Side Calculated Members Viewing Formula Information in SAS Financial Management
Studio 47
2. At the crossing for the Sales Account and Variance Analysis members, select
Tools Cell Information to view the following message:
Note that the cell information reflects the formula expression based on rank. The cell
information includes the formula expression for the Variance Analysis member, because
it is ranked first.
A virtual child is similar to an ordinary leaf member in that a formula can run on a
virtual child. In contrast, a virtual child differs from an ordinary leaf member in that
you cannot assign a formula to a virtual child. A formula on a roll-up member is always
ignored, and the result is the sum of leaf values.
The following window illustrates the optional headers displayed for the Account
dimension type:
In the Models workspace, Model Properties displays the number of members with
formulas on the Formulas page for each dimension in the model, based on the selected
hierarchy and as-of-date.
Formula Basics for Server-Side Calculated Members Viewing Formula Information in SAS Financial Management
Studio 49
For more information about the formulas, click the Show Formulas box. This provides
information about all formulas in the model based on the selected hierarchies and as-of-
dates.
Formula detail can be filtered based on the formula type and is displayed by
dimension member code. Each formula displays the name of the calculated member, the
Dimension that the calculated member is in, and the number of formula expressions on
the member. Expanding the calculated member displays the various formula
expressions on the member. Each formula expression displays the name as well the
formula syntax. Any scoping and/or fixed member information is also included in the
Details window.
50 Viewing Formula Information in Excel Chapter 4
To illustrate, the following message is displayed for the driver formula Allowance for
Doubtful Accounts:
Here are some points to keep in mind when querying for formula details:
In the event of a formula conflict involving two or more formulas on the same
crossing, the formula expression that is ranked higher is displayed.
For modeling formulas and driver formulas, all members of the selected crossing
must be leaf members. Therefore, all dimensions, including Trader and Source,
must have a leaf member selected. This means that you must select a leaf member
for every dimension that is displayed in the table. In addition, the table default
member must be a leaf member for any dimension that is in the model but not
displayed in the table.
52 Viewing Formula Information in Excel Chapter 4
53
5
C H A P T E R
Introduction ................................................................................................................................................. 54
Creating an Excel-Based Calculated Member............................................................................................. 54
Removing an Excel-Based Calculated Member........................................................................................... 59
Editing an Excel-Based Calculated Member .............................................................................................. 60
Viewing Formula Information for Excel-Based Calculated Members ........................................................ 63
Pivoting an Excel-Based Calculated Member ............................................................................................. 63
Resolving Conflicts between Excel-Based Calculated Members ................................................................. 65
Introduction.......................................................................................................................................... 65
Excel-Based Calculated Member Expressions ..................................................................................... 65
Results .................................................................................................................................................. 65
Examples of Excel-Based Calculated Member Formulas ........................................................................... 67
Introduction.......................................................................................................................................... 67
fmValue Function................................................................................................................................. 67
Use ................................................................................................................................................ 67
Syntax ........................................................................................................................................... 67
Example ........................................................................................................................................ 67
fmCode Function .................................................................................................................................. 67
Use ................................................................................................................................................ 67
Syntax ........................................................................................................................................... 67
Example ........................................................................................................................................ 68
fmProperty Function ............................................................................................................................ 68
Use ................................................................................................................................................ 68
Syntax ........................................................................................................................................... 69
Example ........................................................................................................................................ 69
Example ........................................................................................................................................ 69
fmRate Function................................................................................................................................... 70
Use ................................................................................................................................................ 70
Driver Rate Table in SAS Financial Management Studio .......................................................... 70
Syntax ........................................................................................................................................... 70
Example ........................................................................................................................................ 71
fmXRate Function ................................................................................................................................ 71
Use ................................................................................................................................................ 71
Syntax ........................................................................................................................................... 71
Example ........................................................................................................................................ 71
Example of Resulting CDA Formula ............................................................................................ 72
fmCXRate Function.............................................................................................................................. 72
Use ................................................................................................................................................ 72
Syntax ........................................................................................................................................... 72
Example ........................................................................................................................................ 73
Example ........................................................................................................................................ 73
Examples ....................................................................................................................................... 74
Reference to another Excel-Based Calculated Member in the Same Dimension ......................... 74
Absolute References to Cells in the Same Workbook............................................................................ 76
Using Any Excel Function or Valid Excel Expression ......................................................................... 77
Introduction .................................................................................................................................. 77
Example ........................................................................................................................................ 77
Excel-Based Calculated Members and Display Styles ........................................................................ 78
Introduction .................................................................................................................................. 78
Scenario 1: Excel Styles Set to Display Default for Debit and Credit Balances .......................... 78
Scenario 2: Excel Styles Set to Display Credit Balances as Positive ........................................... 79
54 Creating an Excel-Based Calculated Member Chapter 5
Scenario 3: Excel Styles Set to Display Credit Balances as Positive and Referenced Members Not
Displayed on the Table ................................................................................................................. 80
Formulas That Run Out of Bounds ..................................................................................................... 81
Excel-Based Calculated Members on the Web ..................................................................................... 82
Differences between Calculated Members in Excel and on the Web .................................................... 82
Scenario 1. Time Offsets ............................................................................................................... 82
Scenario 2. Referencing a Member or Hidden Member Not on the Table.................................... 82
Scenario 3. Placing an Excel-Based Calculated Member Before or After a Member or Hidden
Member Not on the Table ............................................................................................................. 82
Excel-Based Calculated Members and Supplemental Tables ............................................................. 83
Introduction
Using the SAS Financial Management for Microsoft Excel Add-In, you can create
Excel-based calculated members on a table-by-table basis. Excel-based calculated
members look the same as members that are created in SAS Financial Management
Studio. They are most similar in behavior to reporting formulas, sharing similar
calculation and currency conversion methods. They differ primarily in reuse because
formulas are created and saved locally, not on the server.
Excel-based calculated members support any combination of the following in a
formula expression:
reference to any member in the same dimension
absolute reference to any crossing in a table in the same workbook
absolute reference to any cell in the same workbook
any Excel function or valid Excel expression
The Position page displays the hierarchical view of the current members selected
for display in the table. To determine the placement of the calculated member,
highlight an available member and choose whether to display the calculated
member before or after the selected member.
56 Creating an Excel-Based Calculated Member Chapter 5
5 Type the formula expression directly in the Formula page or use the icons.
Using the Formula Cell Selector (the icon in the lower left) is an easy way to
select dimension members and cell references.
Formula Basics for Excel-Based Calculated Members Creating an Excel-Based Calculated Member 57
Similar to formula definition in Excel, the Formula Cell Selector is updated with
the cell references and dimension members based on cursor placement and
selection.
7 After you complete the formula expression, select Validate to ensure its
accuracy. Click OK and then click Finish.
58 Creating an Excel-Based Calculated Member Chapter 5
In the following window, you can create a new Excel-based calculated member,
view properties of existing members, and delete or disable existing members.
2
Formula Basics for Excel-Based Calculated Members Editing an Excel-Based Calculated Member 61
2 With the cursor in any cell of an active table, select Members Calculated
Members from the SAS Financial Management menu.
Highlight the member that you want to edit.
4 On the Formula tab, modify the formula expression and then click Validate.
You can modify the table using Members Pivot on the SAS Financial
Management menu. The following updated table illustrates the calculated member on
the columns:
You can modify the table to display the Excel-based calculated member as a slicer:
You can nest Excel-based calculated members. In the following table, the Bonus
Percentage calculated member is nested inside the Time Dimension on the columns:
Formula Basics for Excel-Based Calculated Members Resolving Conflicts between Excel-Based Calculated Members 65
Introduction
Excel-based calculated members can conflict only with other Excel-based calculated
members. All server-side formula types (driver, modeling, and reporting) run before
Excel-based calculated members. Therefore, in the event of a conflict involving two or
more Excel-based calculated members, the members can be ordered in a manner similar
to server-side calculated members. Consider the following scenario; there are two Excel-
based calculated members:
Results
If the Training-calculated member is ranked higher than the Variance-calculated
member as shown here, then the Training formula expression is executed and the
Variance formula expression is ignored.
66 Resolving Conflicts between Excel-Based Calculated Members Chapter 5
Introduction
The following sections provide examples for the various functions supported in Excel-
based calculated member formulas.
fmValue Function
Use
The fmValue function is used to retrieve crossing values based on the members
referenced in the formula. This function replaces the Member function in SAS Financial
Management 4.4. Typically, this calculated member is placed on the same dimension as
the member(s) that it references in its formula.
Syntax
fmValue(“<member code name>”)
Example
Variance =
fmValue(“ACTUAL”)-fmValue(“BUDGET”)
fmCode Function
Use
The fmCode function is used to retrieve the dimension member code based on the
dimension referenced in the formula. When used independently of other calculated
member functions, this calculated member should be placed in a dimension other than
the dimension it is referencing in its formula. The following example illustrates this.
Syntax
fmCode(“<dimension code name>”)
68 Examples of Excel-Based Calculated Member Formulas Chapter 5
Example
Org Code =
fmCode(“ORGANIZATION”)
The use of the fmCode function is more typically found in conjunction with other
calculated member functions. This use is illustrated in more complex examples later in
this chapter.
fmProperty Function
Use
The fmProperty function is used to retrieve a dimension member’s standard or custom
property values based on the type of property requested.
Following is a list of the Dimensions and standard property types that can be
requested. Note that property types are case sensitive; write them as shown below in the
context of a formula expression:
ACCOUNT
AccountBehavior
AccountType
BalanceType
ExchangeRateType
Intercompany
ORGANIZATION
Functional Currency
Reporting Entity
TIME
Level
In addition to standard properties, the fmProperty function also retrieves custom
properties created by the user.
When used independently of other calculated member functions, place this calculated
member on a dimension other than the dimension that it references in its formula. The
following example illustrates this.
Formula Basics for Excel-Based Calculated Members Examples of Excel-Based Calculated Member Formulas 69
Syntax
fmProperty(“<dimension code name>”,”<propertytype>”)
Example
Functional Currency =
fmProperty("ORGANIZATION","FunctionalCurrency")
The fmProperty function is useful when it is paired with other calculated member
functions and IF statements. See “Scenario 2” (page 79) in “Excel-Based Calculated
Members and Display Styles” for an example of a more complex calculated member
formula using IF and fmProperty.
To illustrate the use of Custom Properties, the following table displays the custom
property values assigned to various Customer Dimension members.
Example
Manager =
fmProperty(“Customer”,”Manager”)
70 Examples of Excel-Based Calculated Member Formulas Chapter 5
fmRate Function
Use
The fmRate function resolves to a CDARate function. This function is used to retrieve
the driver rate(s) based on the rate type requested. Place this calculated member
function on a dimension other than the dimension in which the rate set is defined on. To
illustrate, assume that an estimated tax rate table was defined based on the IntOrg
dimension. See the following example.
In this rate table, each rate is defined by the specified Internal Organization member.
If a rate is assigned without an Internal Organization member, it is assumed that any
Internal Organization members that are not explicitly stated in the table uses this
generic rate.
Syntax
fmRate(“<rate type code”)
Formula Basics for Excel-Based Calculated Members Examples of Excel-Based Calculated Member Formulas 71
Example
Est Tax Rates =
fmRate(“Tax Rate”)
fmXRate Function
Use
The fmXRate function is used to retrieve simple exchange rates for a given time
period based on the exchange rate type. Following are a list of simple rates and the
correct syntax as they should be used in the formula expression. Note that exchange
rate types are case sensitive; write them as shown below in the context of a formula
expression:
PeriodAverage
PeriodClose
PeriodOpen
Custom1
Custom2
Since exchange rates are defined by time periods, do not place this calculated member
function in the Time dimension. The result of this formula renders to a CDAXRate
function in the table. The following example displays how this formula provides users
more insight to the exchange rates stored in SAS Financial Management Studio.
Syntax
fmXRate("<exchange rate type code>","from currency code","to currency code")
Example
Period Avg Fx Rate – 1 USD per CAD =
fmXrate("PeriodAverage","USD","CAD")
72 Examples of Excel-Based Calculated Member Formulas Chapter 5
fmCXRate Function
Use
The fmCXRate function is used to retrieve complex exchange rates such as historic
and derived rates. Since exchange rates are defined by time periods, do not place this
calculated member function in the Time dimension.
The function should include:
reference to the specific exchange rate type
to-and-from currencies
any dimension code(s) or member code(s) to reference from any additional
dimension(s) in which the member is defined
All other dimension code/member code combinations are retrieved from the slicers and
either row or column members. The following example displays how this formula
provides more insight to the exchange rates stored in SAS Financial Management
Studio.
Syntax
fmCXRate("<exchange rate type code>","<from currency code>","<to currency code>",
"<Dimension Code>","<Member Code>")
Formula Basics for Excel-Based Calculated Members Examples of Excel-Based Calculated Member Formulas 73
Example
Hist Rate – Common Stock - 1 USD per CAD =
fmCXRate("Historic","USD","CAD","ACCOUNT","E12000")
Example of Resulting CDA Formula
CDACXRate("Model","RATE_TYPE","Historic","USD","CAD","ACTUAL",
"JAN2012", "ACCOUNT", "Common Stock", "ORGANIZATION", "Admin Canada",
"CUSTOM1 (Product)", "Product Total.vc", "CUSTOM2 (Customer)", "Customer
Total.vc", "FREQUENCY", "PTD", "ORGANIZATION_TRADER", "ALL", "SOURCE",
"Total")
Excel-based calculated member functions can also be combined with other Excel-
based calculated member functions in a single formula. This enhances the member
functions’ usefulness as well as providing more dynamic formulas and flexibility. The
following examples illustrate more complex formulas that can be created through the
use of multiple functions within a single formula.
The following example combines the use of the fmValue function and fmProperty
function. This formula is useful when account balances are not displayed with the
default setting.
Example
Variance =
=IF(fmProperty("ACCOUNT","BalanceType")="CREDIT",fmValue("ACTUAL")-
fmValue("BUDGET"),fmValue("BUDGET")-fmValue("ACTUAL"))
74 Examples of Excel-Based Calculated Member Formulas Chapter 5
Note that this formula derives its results based on the display state as it appears in
Excel. Any changes in display styles such as positive/negative display of debit and credit
accounts might impact the results of this formula. More on this topic is discussed in
“Excel-Based Calculated Members and Display Styles” (page 78).
The next two formulas are useful to display simple exchange rate values based on the
functional currency for the organizational members displayed.
Examples
Avg Fx Rate per 1 USD =
=fmXrate("PeriodAverage","USD",fmProperty("ORGANIZATION",
"FunctionalCurrency"))
End of Period Fx Rate per 1 USD =
=fmXrate("PeriodClose","USD",fmProperty("ORGANIZATION","FunctionalCurrency"))
Note that the cell is rendered as an absolute reference. Based on the formula
expression, Sublease Income is computed as –35% of the Account member Rent. The
resulting read-only table and related cell reference are displayed as follows:
Example
Subtotal - Net Rental Expense =
SUM(fmValue("R32000"),fmValue("Est. Sublease Income"))
78 Examples of Excel-Based Calculated Member Formulas Chapter 5
The following table displays the results for the calculated member Subtotal - Net
Rental Expense:
Scenario 1: Excel Styles Set to Display Default for Debit and Credit
Balances
Properties defined on the Model in SAS Financial Management Studio are set to
display debit accounts with a debit balance set to positive and credit accounts with
credit balances as negative numbers.
On the table, Table Properties are set to display debit accounts with a debit balance
as Default and credit accounts with credit balances as Default.
Variance = fmValue("BUDGET")-fmValue("ACTUAL")
Formula Basics for Excel-Based Calculated Members Examples of Excel-Based Calculated Member Formulas 79
With the members referenced in the Excel-based calculated member on the table in
this example, the formula expression for a single crossing resolves as follows:
=$D$11-$C$11
With the members referenced in the Excel-based calculated member on the table, the
formula expression for a single crossing resolves as follows in this example:
=IF(“Credit”=”CREDIT”,$C$11-$D$11,$D$11-$C$11)
Even when the members referenced in the Excel-based calculated member are not on
the table, FM Table Property styles are still honored and the Variance is calculated
correctly. In order to do this, the resulting formula expression for a given crossing
resolves to the following:
=IF("Credit"="CREDIT",(CDAGet("Formula Guide Model", "Account", "Net Inc",
"Analysis", "Actual", "Organization", "Sales", "Product", "Product Total", "Customer",
"Customer Total", "CURRENCY", "USD", "Time", "Jan 2012", "FREQUENCY", "PTD") *
TableCreditNeg("NewTable0") / TableScale("NewTable0"))-(CDAGet("Formula Guide
Model", "Account", "Net Inc", "Analysis", "Budget", "Organization", "Sales", "Product",
"Product Total", "Customer", "Customer Total", "CURRENCY", "USD", "Time", "Jan
2012", "FREQUENCY", "PTD") * TableCreditNeg("NewTable0") /
TableScale("NewTable0")),(CDAGet("Formula Guide Model", "Account", "Net Inc",
"Analysis", "Budget", "Organization", "Sales", "Product", "Product Total", "Customer",
"Customer Total", "CURRENCY", "USD", "Time", "Jan 2012", "FREQUENCY", "PTD") *
TableCreditNeg("NewTable0") / TableScale("NewTable0"))-(CDAGet("Formula Guide
Model", "Account", "Net Inc", "Analysis", "Actual", "Organization", "Sales", "Product",
"Product Total", "Customer", "Customer Total", "CURRENCY", "USD", "Time", "Jan
2012", "FREQUENCY", "PTD") * TableCreditNeg("NewTable0") /
TableScale("NewTable0")))
The additional information in the formula expression occurs when the member(s)
referenced in the formula are removed from the table. This additional detail provides
the information to support associated styles such as scaling, debit, and credit settings
selected in Excel Properties.
In the example above, the resulting value for Beginning Balance - Equipment for Jan
2012 is 0.00 since Dec 2011 is not in the cycle or model.
6
C H A P T E R
Fixed Members
You can select only one member per dimension as a fixed member.
1 Use the Assign fixed check box in the Formula wizard to select fixed members on
an expression-by-expression basis.
The results of the fixed member selection for a given dimension are displayed. You
can continue to select additional fixed members for different dimensions, modify
current selections, and/or remove current selections.
For existing calculated members, fixed member selection is available through
Member Properties Formulas Expression.
Advanced Formula Concepts Fixed Members 89
To illustrate how fixed members work, consider the following modeling formula
example:
Formula
Sales = ["ACCOUNT"="Price"]*["ACCOUNT" ="Units Sold"]*-1
Fixed Members
Product dimension: Simulation
Adding Product member Simulation as a fixed member has the same effect as if the
formula expression were written as follows:
Sales = ["ACCOUNT"="Price"]["PRODUCT"="Simulation"]*["ACCOUNT" ="Units Sold"]
["PRODUCT"="Simulation"]*-1
Facts
The following data entry table displays the facts that were entered for Price and Units
Sold for the leaf members under Product member Video Games.
Results
In the following table, results for Sales for all leaf members under Product member
Video Games are (3,000.00). This is computed by multiplying the Price for Simulation by
the Units Sold of Simulation: (20 x 150)* -1 = (3,000.00).
Since the Sales account is a modeling formula, the Sales account result for product
Video Games is (15,000.00). This is the sum of all the subordinate leaf members. Note
that the formula runs at Video Games.vc as well. This is the intended behavior and
should be considered when using fixed members.
90 Fixed Members Chapter 6
Facts
The following data-entry table displays the facts that were entered for Price and Units
Sold for the leaf members under Product member Video Games.
Results
In the preceding table, results for Sales for all leaf members under Video Games are
(5,000.00). This is computed by multiplying the Price for Arcade by the Units Sold of
Arcade: (25 * 200.00)* -1 = (5,000.00).
In the following scenario, the formula expression is modified slightly so that the
product member Arcade is explicitly stated only with the Units Sold account. The fixed
member reference and the facts remain unchanged.
Formula
Sales = ["ACCOUNT"="Price"]*["PRODUCT"="Arcade"] ["ACCOUNT"="Units Sold"]* -1
Fixed Members
Product dimension: –Simulation
92 Formula Scope Chapter 6
Results
In the preceding table, results for Sales for all leaf members under Video Games are
(4,000.00). This is computed by multiplying the Price for Simulation by the Units Sold
for Arcade: (20 * 200)* -1 = (4,000.00).
Formula Scope
Formula scope is an optional means of restricting where a formula runs. It can be
applied on an expression-by-expression basis and is available for all server-side
formulas (reporting, driver, and modeling formulas). From a performance standpoint,
Advanced Formula Concepts Formula Scope 93
formula scope is most effective when it is used with modeling formulas to limit the
number of crossings where a formula runs.
There are two different means of scoping formulas:
Member scoping
Property scoping
Member scoping is based on the assignment of member selection rules on selected
members. Property scoping is based on the assignment of operators and available
property values for the selected property type. Member and property scoping can be
used independently of one another or in combination. Applying both member and
property selection rules results in the intersection of all crossings based on the member
and property selection rules applied. The following sections illustrate the use and
related examples of formula scoping.
In defining formula scope, you can select multiple members per dimension. You define
formula scope on an expression-by-expression basis in the Formula wizard, as shown
here:
94 Formula Scope Chapter 6
2 Click the green plus icons to select members or properties for scoping.
For member scoping, select the desired dimension type, dimension, and hierarchy.
Members are displayed in the context of the current view of the selected
dimension and hierarchy. You can select from the available hierarchies and choose
multiple members in each dimension. Highlight the desired member(s) and choose
the Member Selection Rule associated with the member as well as whether to
apply to the virtual children.
96 Formula Scope Chapter 6
You can select multiple property types and values in each dimension.
6 Click Add and Close to see the summary of member and property scoping on the
Scope tab.
98 Formula Scope Chapter 6
In the following data entry table, you can see the crossings for the Sales accounts
that are calculated based on their gray color.
Note: Since the calculated member is scope for Manager Property Type values
McKnight and Montgomery, the formula execution also applies to the virtual children as
well. The values at Direct and Government are due to the aggregation of the driver
formula results since driver and modeling formulas run only at leaf-level crossings.
Customer members associated with property type values other than McKnight and
Montgomery are rendered as yellow, writeable cells at leaf levels for the Sales account.
When you select a member for formula scope, a member selection rule is assigned.
Member selection rules are based on the formula type of the calculated member and the
selected dimension type.
For driver and modeling formulas, there are three member selection rules:
Member available only for the Analysis dimension
Leaf descendants of Member if any, otherwise Member
Exclude
Because the Analysis dimension has only flat hierarchies, the only selection rule
available for an Analysis member is Member. Because the Worldwide Operations
IntOrg member is a roll-up member and the formula is a reporting formula, you can
select one of ten member selection rules. For this example, Worldwide Operations is
assigned Non-leaf descendants of member if any, otherwise Member. You can
choose to apply the virtual child to this rule.
102 Formula Scope and Member Selection Rules Chapter 6
The table below displays only the rows that have data in them. Note that the Gross
Profit Percentage account member does not return results for Worldwide Operations,
Central, Eastern, Western, European Sales, Canada Sales and Mexico Sales. The
formula only ran for U.S. Operations, Sales, European Operations, Canada Operations,
and Mexico Operations since there was data available and these members all qualified
as Non-leaf descendants of Worldwide Operations.
Introduction
You can define an unlimited number of formulas on a single calculated member. To
improve formula performance, maintenance, and manageability, define multiple
formulas on one member as an alternative in the following scenarios:
Formula 2
Name: Joy Stick
Expression: ["ACCOUNT"="Sales"]*-0.25
Scope: ["PRODUCT"="Joy Stick"]
Formula 3
Name: Flight Stick
Expression: ["ACCOUNT"="Sales"]*-0.30
Scope: ["PRODUCT"="Flight Stick"]
Follow the steps used to create a new calculated member or to add a formula to an
existing member when you define multiple formulas on the same member. For more
information about creating formula expressions, see Chapter 4, “Formula Basics for
Server-Side Calculated Members.” The formula expression name is visible in SAS
Financial Management Studio and through Cell Information in Excel.
In addition, each formula has its own Fixed member and scope selections. The results
of creating a calculated member with multiple formulas are displayed on the Formulas
tab:
Advanced Formula Concepts Ranking Multiple Formulas 105
Introduction
Each formula is assigned a rank when you create it. The initial rank order for a
calculated member is based on the order in which the formulas were created. The rank
of a formula determines which formula is executed in the event of formula scope overlap.
To illustrate the ranking of formulas, consider the Discounts example in “Defining
Multiple Formulas on One Member,” modified slightly as follows:
Formula 1
Name: All Others
Expression: ["ACCOUNT"="Sales"]*-0.25
Scope: Not limited
Formula 2
Name: Game Controller
Expression: ["ACCOUNT"="Sales"]*-0.20
Scope: ["PRODUCT"="Game Controller"]
On the Formulas tab for the modified Discounts calculated member, note that the
formula All Others is ranked first.
106 Ranking Multiple Formulas Chapter 6
Results
The following table displays the results when the All Others formula is ranked first,
rendering the computed Discounts values of 25% for all Product members:
When the formulas are rearranged so that the Game Controller formula is ranked
first, the warning message is not displayed.
Advanced Formula Concepts Ranking Multiple Formulas 107
Results
The following table displays the results when the formula for the Game Controller
Product member is ranked first. This results in Discounts of 20% for Game Controller
and 25% for all other Product members.
108 Ranking Multiple Formulas Chapter 6
109
7
C H A P T E R
Introduction
This chapter identifies formula expressions that are ignored, invalid, or not rendered
in SAS Financial Management. These three formula expression restrictions can be
defined as follows:
Ignored: Calculated members in this category are not executed due to the priority
of other computations such as aggregation/rollup logic. Warning messaging is
provided on the Formulas page for Model Properties. Since the formula
expression is ignored, there is no cell information.
Invalid: Calculated members in this category are not executed at query time
because they are incorrect in the context of the model. In most cases, these
expressions pass validation in the Formula Editor. However, the expressions
have warning messages on the Formulas page for Model Properties. An invalid
driver formula is displayed as a gray, non-writeable cell with a value of 0.
Modeling and Reporting formulas render as red cells. Warning messaging is
provided through Cell Information for Modeling and Driver formulas.
Not Rendered: This type of formula restriction applies to the use of constants in
Driver and Modeling formulas. Warning messaging is provided on the Formulas
page for Model Properties. For both formula types, the result is a gray, non-
writeable cell with a value of 0. No warning messaging is provided through Cell
Information.
Description
Any formula type with an expression on a roll-up member in the dimension it was
created in is always ignored. The result is the sum of the leaf values.
Example
Consider the following Account hierarchy, where account R40000 (Staff Expenses) is a
driver formula.
Staff Expenses
Salaries
Benefits
Travel
Other Selling Expenses
Gross Profit
Driver Formula
Staff Expenses = ["ACCOUNT" = "Gross Profit"]* -0.2
Calculated Members Restrictions Time Offsets: Formulas That Run Out of Bounds 111
Results
The following table displays the results. Because account (Staff Expenses is a roll-up
member, the formula is ignored and the leaf values are summed.
For Jan 2012, the result is computed as 30,000.00 + 3,000.00 + 1,500.00 + 1,000.00 for
a result of 35,500.00, instead of the formula for Staff Expenses executing as (100,000.00)
* -0.2 to yield 20,000.00.
Description
A formula referencing a time offset such as ["TIME"=CURRENT("TIME")-x] results in
crossings where the formula runs that are “out of bounds.” This happens because the
formula is seeking inputs from crossings that do not exist. Crossings where formulas
run out of bounds are deemed not applicable to the formula and return a value of 0.
Example
In the following example, Units Sold - Prior Year is a Driver formula defined as
follows:
Results
The following table displays the results for Account members Units Sold and Units
Sold - Prior Year. In this cycle, Jan 2012 is the first-time member in the Time hierarchy.
Based on the formula expression, results for time members from Jan 2012 through Dec
2012 return a 0. This is because their formula inputs (for example, Jan 2011 and Feb
2011) do not exist and are “out of bounds.”
Warning Message
No warning is provided.
Calculated Members Restrictions Balance Account Calculated Members Scoped to Time 113
Description
A calculated member on a balance account type scoped on the Time dimension is
considered invalid. If the calculated member is assigned as a Driver, the result is 0 for
the time periods to which it is scoped and in any future time periods. If the calculated
member is assigned as a Modeling formula, the result is a red cell (NaN) for the time
periods to which it is scoped and any future time periods.
Example
In the following example, Account member Beginning Balance - Equipment is a
Modeling formula that takes the Actual value from account member A26000 (Ending
Balance, Equipment) for the prior year’s ending period as a starting point for budgeting
purposes:
Calculated Members Restrictions Referencing a Dimension and/or Member Not in the Model 115
Results
The following table displays the results of scoping a Modeling formula on Time for a
Balance account type. As displayed on the Formulas tab, the Opening Balance -
Equipment Account member is scoped to all leaf descendants of the Time member 2013.
As a result, any Time periods in the formula scope as well as future time members
return red cells (NaNs).
Warning Messages
SAS Financial Management Studio Message
The following warning message is displayed in SAS Financial Management Studio on
the Details pane for Show members on the Formulas page for Model Properties:
A modeling or driver formula on a balance account cannot be scoped for
the time dimension type.
Excel Message
For a Modeling formula, the following cell information is provided:
Query failed due to a formula error.
Description
A calculated member that references a dimension and member that is not in the
model is invalid. A calculated member that references a member that is not in the
hierarchy is also invalid. If assigned as a Driver, the result is 0. If the calculated
member is assigned as a Modeling or Reporting formula, the result is a red cell (NaN).
Example
In the following example, Account member Training is a Modeling formula that
references a Product member that is no longer in the hierarchy.
Calculated Members Restrictions Referencing a Dimension and/or Member Not in the Model 117
Results
The following table displays the results of a Modeling formula referencing a member
that is not in the hierarchy.
Warning Messages
SAS Financial Management Studio
The following warning message is displayed in SAS Financial Management Studio on
the Details pane for Show members on the Formulas page for Model Properties:
Formula references a member (Online) that is not in the model.
Excel
For a Modeling or Reporting formula, the following cell information is provided:
Query failed due to a formula error.
118 Referencing Only Constants Chapter 7
Description
Calculated members referencing only constants in the formula expression are invalid.
Examples of formula expressions not supported are displayed below:
X=1
Y =DRATE("")
Z= DRATE("") +/- 1
If assigned as either a Driver or Modeling formula, the displayed result is a gray, non-
writeable cell with a value of 0.
Example
In the following example, Account member Price per Gallon is a Modeling formula
that references a constant.
Calculated Members Restrictions Referencing Only Constants 119
Results
The following table displays the results of a Modeling formula referencing a constant.
Warning Messages
SAS Financial Management Studio
The following warning message is displayed in SAS Financial Management Studio on
the Details pane for Show members on the Formulas page for Model Properties:
Constant expressions are not supported for modeling or driver formulas.
Excel
For a Modeling or Driver formula, the following cell information is provided:
120 Circular References Chapter 7
Circular References
Description
Calculated members with formula expressions containing circular references are
invalid.
Example
In the following example, Estimated Bonus Expense is calculated based on Net
Income. In the existing hierarchy, the Bonus account expression is a circular reference
since Estimated Bonus Expense is a descendant of Net Income.
Calculated Members Restrictions Circular References 121
Results
The following table displays the results of the circular reference in the Estimated
Bonus Expense account member. The circular reference affects all account members
that it rolls up to.
Dividing by Zero
Description
A calculated member where the divisor returns a value of 0 is invalid.
Example
In the following example, Gross Margin Percentage is calculated by dividing Gross
Profit by Total Sales.
Calculated Members Restrictions Dividing by Zero 123
Results
In the following table, Sales results have not been entered yet. Therefore, the formula
currently is being divided by 0 pending Sales account data input.
Recommendation
To prevent this type of invalid calculated member, the formula expression can be re-
written in the following manner:
By including an argument in the event that the divisor is 0, the formula expression is
no longer considered invalid.
The resulting table is as follows:
125
8
C H A P T E R
Introduction
SAS Financial Management has three statistical account types:
Statistical Flow. This account type resembles the Expense and Revenue account
types. It can participate in currency conversion, and it can be a source account to
Retained Earnings.
Statistical Balance. The Statistical Balance account type resembles the Asset and
Liability account types. However, it cannot be a source account to a Cumulative
Translation Adjustment account.
Statistical. A Statistical account type cannot roll up to a parent member or have
any children. The purpose of the Statistical account type is to represent values
such as prices and ratios. Statistical account behavior differs based on whether it
is a non-calculated member or a calculated member with a reporting formula.
This chapter addresses the behavior of the Statistical account type. Statistical
accounts can be used for data input, and they can be assigned as calculated members.
The following sections discuss Statistical account behavior for these two uses separately
and describe how this account types differs from Statistical Flow and Statistical Balance
account types.
126 Statistical Accounts for Data Entry Chapter 8
Introduction
Statistical accounts data entry are unlike accounts of other types in that they do not
participate in hierarchical roll-ups, time aggregation, or frequency aggregation. Given
the intent of the Statistical account type, the values generated from hierarchical roll-
ups, time aggregation, or frequency aggregation are nonsensical. To illustrate, consider
the following example:
Facts
The facts for the Price account are shown here:
Hierarchical Roll-Ups
If the table is expanded to include roll-up members in dimensions such as Product and
Organization, then the results at the roll-up members for the Price account result in red
cells (NaN: Not a Number).
Statistical Account Behavior Statistical Accounts for Data Entry 127
The Account “Price” returns a value when it is crossed with leaf members in all other
dimensions, as shown in the above example. Product members “Game Controller”, “Joy
Stick”, and “Flight Stick” are leaf members. Organization members “Central”, “Eastern”,
and “Western” are leaf members. Selected Slicer members also are leaf members.
The Account “Price” returns red cells (NaN) when crossed with a roll-up member in
any dimension. Product member “Hardware” and Organization member “Sales” are both
roll-up members. Therefore, they always return a red cell when crossed with the
Account “Price”.
The cell information for a crossing at a roll-up point is displayed as follows:
Time Aggregation
Time aggregation results are similar to hierarchical roll-up results in that the
Statistical account value results in a red cell. The cell information that is displayed at a
time roll-up is the same as what is shown in “Hierarchical Roll-Ups.”
128 Statistical Accounts for Data Entry Chapter 8
Frequency Computation
Statistical account values do not participate in frequency computation. Regardless of
the frequency selected for a given Statistical account, the resulting value is the same.
The following table displays the results of the Price account with the valid frequencies:
Statistical Account Behavior Calculated Statistical Accounts 129
Data Entry
Because non-calculated Statistical accounts do not participate in hierarchical roll-ups,
all values must be entered at the leaf level for each dimension in the model, including
Source and Trader. The following data-entry table illustrates this requirement:
In the table above, the yellow cells represent crossings in which all dimension
members are at a leaf level. The red cells represent crossings where statistical roll-ups
are not valid.
Note: If a dimension has a default read member that is a roll-up and a default write
member that is a leaf member, the dimension must still be included on the table.
Introduction
Statistical accounts that are reporting formula-calculated members behave differently
from non-calculated Statistical accounts. To illustrate the differences, here is an
example of a calculated Statistical account:
Formula
Gross Profit Percentage = ["ACCOUNT"="Gross Profit"]/["ACCOUNT"="Sales"]
Gross Profit Percentage is a Statistical account. Gross Profit and Sales are Revenue
accounts.
130 Calculated Statistical Accounts Chapter 8
Facts
The facts for the Sales and Cost of Sales accounts are shown here:
Hierarchical Roll-Ups
If the table is expanded to include the roll-up members in dimensions such as
Product, Customer, and Organization, then the results at roll-up members for the Gross
Profit Percentage account are displayed. Statistical accounts that are calculated
members do display values at roll-up points, as shown here:
Statistical Account Behavior Calculated Statistical Accounts 131
Frequency Computation
Statistical accounts that are calculated members also participate in frequency
computation. To illustrate, consider the following table:
Restrictions
Non-calculated Statistical accounts do not participate in hierarchical roll-ups or Time
aggregation and return red cells (Not a Number). This means that the calculated
Statistical account member returns a red cell at a roll-up when it refers to a non-
calculated Statistical account member in its formula expression. However, a calculated
Statistical account member returns a value at a roll-up when it refers to another
calculated Statistical account member. If you need to use a Statistical account in the
formula expression, consider using a Statistical Balance account.
132 Calculated Statistical Accounts Chapter 8
133
9
C H A P T E R
ANCESTOR Function
Use
Introduction
Use the ANCESTOR function to navigate a hierarchy, primarily the TIME hierarchy.
This function enables a formula to use a member that is a certain number of levels
above the current member or to use a specified period type such as Year.
The ANCESTOR function takes two arguments and supports an optional third
argument.
First Argument
The first argument can be either a dimension type code or a function that returns a
member code:
If the first argument is a dimension type code, then this code implicitly specifies
the member of that dimension type that is in the crossing where the function is
evaluated.
If the first argument is a function that returns a member code, then the returned
code explicitly specifies a member.
Second Argument
The second argument is an ancestor designator. The ancestor designator can take two
forms: Number of Levels or Level Name:
Number of Levels: An integer indicates a number of hierarchical levels above the
member that is specified by the first argument. You can use an integer as the
second argument no matter what the first argument is.
Commonly Used Functions ANCESTOR Function 135
Level Name: If the first argument is the Time dimension type code or a function
that returns a Time period code, then you can use one of the following period type
values to indicate a particular level of the Time hierarchy:
AllYears
Year
HalfYear
QuarterYear
Month
Week
Day
Syntax
ANCESTOR("dimension type code", number_of_levels)
Returns the member code of the ancestor a given number of levels above the current
member for a dimension.
ANCESTOR("dimension type code","level name")
Returns the member code of the ancestor at a named level (like “Year”) above the
current member for a dimension.
Example
Beginning Balance - Equipment =
["ACCOUNT"="Ending Balance - Equipment"]["TIME"=ANCESTOR("TIME","Year",-1)]
In this formula, the ANCESTOR function is used on the Beginning Balance -
Equipment account to return the prior year value of the Ending Balance - Equipment
account.
136 CURRENT Function Chapter 9
CLOSINGPERIOD Function
Use
This function returns the code of the member that satisfies these two conditions:
It belongs to the dimension type that is specified in the function.
It is the last-listed leaf member that is hierarchically subordinate to the member
of the specified dimension type that is in the crossing where the function is
evaluated.
If the member of the specified dimension type that is in the crossing where the
function is evaluated is a leaf member, then the CLOSINGPERIOD function returns the
code of that member. In other words, the CLOSINGPERIOD function returns the same
value as the CURRENT function in this case.
The CLOSINGPERIOD function takes one argument, a dimension type code. It is
primarily used with the Time dimension type.
Syntax
CLOSINGPERIOD(<dimensionTypeCode>)
Example
In this formula, the CLOSINGPERIOD function works with the ANCESTOR to
return the prior year’s value for Dec 2012, which is the last leaf period of the prior year.
Sales =
["ACCOUNT"="Sales"]["TIME"=CLOSINGPERIOD(ANCESTOR("TIME","Year",-1))]
CURRENT Function
Use
The CURRENT function returns the code of the member that satisfies these two
conditions:
It belongs to the dimension type that is specified in the function.
It is in the crossing where the function is evaluated.
The CURRENT function takes one argument, a dimension type code. It is most often
used as part of a relative reference in a Time hierarchy. The CURRENT function also
supports an optional second argument which is an offset for a property code type of
integer.
Commonly Used Functions CURRENT Function 137
In this example, the CURRENT function is used on the Units Sold account. It
subtracts a period of 12 months to retrieve the prior year’s Actual Units Sold. Then, the
value is multiplied by 1.1 to derive the budgeted values for 2013.
In this example, the CURRENT function is used on the Units Sold account. It
subtracts a dynamic offset using the custom property “TimeOffset” to retrieve the Actual
Units Sold from a previous Time period. Then, the value is multiplied by 1.1 to derive
the budgeted values for 2013. Jan 2013 retrieves the value from 12 periods in the past,
Feb 2013 retrieves the value from 11 periods in the past, and Mar 2013 retrieves the
value from 12 periods in the past. The value of the TimeOffset custom property is
displayed on the columns in the following table. The Custom Property Type must be
Integer to be used with the CURRENT function.
DRATE Function
Use
Use the DRATE function to retrieve the numeric values from the Driver Rate Sets
tab in the Rates workspace.
A driver rate set consists of tables that are specific to driver rate types. Each table
contains a “Rate” column of numeric values and several columns that represent
dimension types. Each table row associates the numeric value that it contains with a
specific dimension member or set of members.
The driver rate set that the DRATE function references is determined by these two
things:
the Analysis member for which the function is evaluated
the driver rate set that is associated with that Analysis member in the model
properties
Syntax
DRATE("driver rate type code")
Example
Income Tax =
IF(["ACCOUNT"="Income Before Taxes"]<0,["ACCOUNT"="Income Before Taxes"]*
DRATE("TaxRate2013")*-1,0)
In this formula, the DRATE function works on the Income Tax account member. The
desired outcome is to multiply Income before Taxes by a predefined rate that varies by
Organization to return an estimated Income Tax value. If Income Before Taxes is less
than zero, then the Income Tax account member will be zero.
140 IF Function Chapter 9
The DRATE for TaxRate2013 is displayed as the last row on this report by using an
Excel calculated member with the following syntax:
=fmRate("TaxRate2013")
IF Function
Use
The IF function returns one value if the condition specified evaluates to TRUE and
another value if it evaluates to FALSE. Use IF to conduct conditional tests.
Syntax
IF(<condition>,<trueExpression>,<falseExpression>)
Example
Profit Margin % =
IF(["ACCOUNT"="Net Sales"]=0,0,["ACCOUNT"="Net Income"]/["ACCOUNT"="Net
Sales"])
In this formula, the IF statement displays a zero when the denominator is zero.
Otherwise, the Profit Margin percentage is calculated by dividing Net Income by Net
Sales.
Commonly Used Functions NESTIF Function 141
NESTIF Function
Use
The NESTIF function returns a value that depends on the truth values of one or more
Boolean expressions. The NESTIF function takes an even number of arguments, which
are arranged in pairs. The second member of each pair is an expression whose value
might be returned. These are the even-numbered arguments of the function. The first
member of each pair is a Boolean expression that is associated with the second member
of the pair. These are the odd-numbered arguments of the function.
A Boolean expression can compare two character values or two numeric values.
Within Boolean expressions, you can use any Boolean operators and comparison
operators that are available on the Formula Editor window’s symbol toolbar.
The function returns the first even-numbered argument that is associated with a true
Boolean argument.
Syntax
NESTIF(<condition1>,<trueExpression1>,< condition2>,<trueExpression2>, ...)
Example
Bonus Expenses =
NESTIF(
["TIME"=ANCESTOR("TIME","Year")]["ACCOUNT"=“Sales”]<=1.1*["TIME"=ANCEST
OR("TIME","Year",-1)]["ANALYSIS"="Actual"]["ACCOUNT"=“Sales”],
1.1*["ACCOUNT"=“Bonus Expenses”]["TIME"=ANCESTOR("TIME","Year",
-1)]["ANALYSIS"="Actual"]/12,
(["TIME"=ANCESTOR("TIME","Year")]["ACCOUNT"=“Sales”]>1.1*["TIME"=ANCESTO
R("TIME","Year",
-1)]["ANALYSIS"="Actual"]["ACCOUNT"=“Sales”]) AND (
["TIME"=ANCESTOR("TIME","Year")]["ACCOUNT"=“Sales”] <=
["TIME"=ANCESTOR("TIME","Year",
-1)]["ANALYSIS"="Actual"]["ACCOUNT"=“Sales”]),
["ACCOUNT"=“Bonus Expenses”]["TIME"=ANCESTOR("TIME","Year",
-1)]["ANALYSIS"="Actual"]/12,
["TIME"=ANCESTOR("TIME","Year")]["ACCOUNT"=“Sales”]>["TIME"=ANCESTOR("T
IME","Year",
-1)]["ANALYSIS"="Actual"]["ACCOUNT"=“Sales”],
0
)
This NESTIF statement works with the ANCESTOR function. The desired outcome is
to calculate Sales based upon the % change from last year’s Actuals. If Sales >=110% of
last year, Bonus Expenses are 110% of last year. If Sales are at least equal to but less
than 110% of last year, Bonus Expenses are the same as last year. If Sales are less than
last year, then Bonus Expenses are zero. Note that Sales carries a credit balance so the
142 OPENINGPERIOD Function Chapter 9
greater than and less than signs work in conjunction with that. This is a modeling
formula scoped to Budget and Forecast Analysis members and also scoped to leaf
descendants of the year 2013.
OPENINGPERIOD Function
Use
The OPENINGPERIOD function returns the code of the member that satisfies these
two conditions:
It belongs to the dimension type that is specified in the function.
It is the first-listed leaf member that is hierarchically subordinate to the member
of the specified dimension type that is in the crossing where the function is
evaluated. It is primarily used with the Time dimension type.
Syntax
OPENINGPERIOD(<dimensionTypeCode>)
Example
Avg Receivables Balance =
SUM(["ACCOUNT"="Accounts & Notes Receivable"]
["TIME"=OPENINGPERIOD(ANCESTOR("TIME","Year"))]:
["ACCOUNT"="Accounts & Notes Receivable"] ["TIME"=CURRENT("TIME")])
/(PROPERTY("TIME","Month_number"))
In this example, the OPENINGPERIOD function works with the SUM function and
the PROPERTY function to calculate the year-to-date average balance of the Accounts
and Notes Receivable account.
Commonly Used Functions PARENT Function 143
PARENT Function
Use
This function returns the code of the member that satisfies both of these conditions:
It belongs to the dimension type that is specified in the function.
It is the hierarchical parent of the member of the specified dimension type that is
in the crossing where the function is evaluated.
The PARENT function takes one argument, a dimension type code.
Syntax
PARENT(<dimensionTypeCode>)
Example
Net Sales =
["ACCOUNT"="Units Sold"]* -1 *
["ACCOUNT"="Price"]["PRODUCT"=VIRTUALCHILD(PARENT(CURRENT
("PRODUCT")))]
144 PREVIOUS Function Chapter 9
In this example, the PARENT function works with the VIRTUALCHILD and
CURRENT functions. The desired outcome is to multiply Units Sold for each product by
the Price that is entered at the virtual child of the current parent in the product
hierarchy.
PREVIOUS Function
Use
The PREVIOUS function returns the code of the member that satisfies these two
conditions:
It belongs to the dimension type that is specified in the function.
It is at the same hierarchical level, and immediately previous to, the member of
the specified dimension type that is in the crossing where the function is
evaluated.
The PREVIOUS function takes one argument: a dimension type code. It is most often
used as part of a relative reference in a Time hierarchy.
Syntax
PREVIOUS(<dimensionTypeCode>)
Example
The expression ranked first is named “January”, and the syntax is as follows.
Previous Period Salaries =
["ACCOUNT"="Total Salaries"]["TIME"=PREVIOUS("TIME")]["ANALYSIS"="Actual"]
Commonly Used Functions PREVIOUS Function 145
In this example, the PREVIOUS function works with the Previous Period Salaries
account to retrieve the previous period’s value from the Total Salaries account. In Jan
2013, the previous period’s value is retrieved from the Actual Analysis member. In all
subsequent time periods, the previous period’s value is retrieved from the Budget
Analysis member.
Commonly Used Functions PROPERTY Function 147
PROPERTY Function
Use
The PROPERTY function returns the value of a specified property that belongs to the
dimension member that is specified in the function. The PROPERTY function returns a
string value. In a comparison, it must be compared against a quoted string.
This is the list of standard property codes that can be used by this function and the
values that the function can return for each of them. Note that these property codes are
case sensitive when used by the PROPERTY function. You can use the PROPERTY
function to retrieve the values of custom member properties, as illustrated in the
OPENINGPERIOD example.
AccountType
The account type of an account. This property is valid only if the member is an
account. The following values can be returned:
Asset
Liability
Equity
Revenue
Expense
RetainedEarnings
CTA
StatisticalBalance
StatisticalFlow
NonFrequency
BalanceType
The balance type of an account. This property is valid only if the member is an
account. The following values can be returned:
Credit
Debit
AccountBehavior
The category to which the account type belongs. This property is valid only if the
member is an account. The following values can be returned:
Balance
CTA
Flow
Hybrid
NonFrequency
Note: NonFrequency is another name for the Statistical account type. Hybrid is
another name for the RetainedEarnings account type.
148 PROPERTY Function Chapter 9
ExchangeRateType
The exchange rate type of an account. This property is valid only if the member is an
account. The following values can be returned:
PeriodAverage
PeriodClose
PeriodOpen
Custom1
Custom2
Derived
Historic
None
FunctionalCurrency
The functional currency of an organization. This property is valid only if the member
is an organization.
Intercompany
Indicates whether an account is an intercompany account. This property is valid only
if the member is an account. The following values can be returned:
True
False
Level
The period type of a time period. This property is valid only if the member is a time
period. The following values can be returned:
AllYears
Year
HalfYear
QuarterYear
Month
Week
Day
ReportingEntity
Indicates whether an organization is a reporting entity. This property is valid only if
the member is an organization. The following values can be returned:
True
False
Syntax
PROPERTY(<dimensionTypeCode>,< propertyCode>)
Commonly Used Functions PROPERTY Function 149
Example
The first expression is named “Assets and Liabilities”, and the syntax is as follows.
Yield =
["ACCOUNT"=PROPERTY("ACCOUNT","link")]["ANALYSIS"="Actual"]/31*365/
["ANALYSIS"="Actual"]
This formula is scoped to AccountType = Asset and Liability.
The second expression is named Revenue and Expense, and the syntax is as follows.
Yield =
["ANALYSIS"="Actual"]/31*365/["ANALYSIS"="Actual"]["ACCOUNT"=PROPERTY
("ACCOUNT","link")]
150 ROUND Function Chapter 9
In this formula, the PROPERTY function is used to look up the Account which will be
used in the calculation of the yield percentage.
ROUND Function
Use
The ROUND function rounds an argument to a given number of digits. The first
argument is required and represents the member or value to be rounded. The second
argument is optional (number of digits). The arguments must have a numeric value. If
the specified number is exactly midway between two integers and the second argument
is not provided, then the larger integer is returned. The number 2.5 is rounded up to 3.0,
and the number (2.5) is rounded to (3.0).
Commonly Used Functions ROUND Function 151
Syntax
ROUND(<number>, <number_of_digits>)
SUM Function
Use
This function returns the sum of its arguments. The SUM function can take any
number of arguments. All the arguments must have numeric values. For example,
SUM(1, 2, 3, 3, 16) returns 25.
You can use a colon to specify a range of crossings, as in the following example:
SUM(["TIME"="JAN2013"]:["TIME"="JUN2013"])
For range specifications, the first and last crossings must be at the same level in a
hierarchy. The specified range can include only crossings at the same level. Range in
TIME using different period types should not be used. An example is a range starting
with a period type of Month and ending with a period type of Year.
The same number of dimensions should appear on both sides of the colon.
The member on the left side of the colon must have a location in the hierarchy that is
before the member on the right side of the colon. This can be an issue if you use the
same formula in different hierarchies.
Syntax
SUM(<set>)
Example
The first expression defines the calculation for the Year level in the TIME hierarchy.
Rolling = SUM(["TIME"=OPENINGPERIOD(ANCESTOR("TIME","Year"))]:["TIME"=
CLOSINGPERIOD(ANCESTOR("TIME","Year"))])
Commonly Used Functions SUM Function 153
The second expression is scoped to the Quarters and has the following syntax:
SUM(["TIME"=OPENINGPERIOD(ANCESTOR("TIME","QuarterYear"))]:["TIME"=
CLOSINGPERIOD(ANCESTOR("TIME","QuarterYear"))])
The scoping is defined as follows.
The third expression is not scoped and uses the following expression.
IF(PROPERTY("TIME","Flag") ="1", ["ANALYSIS"="Actual"],
["ANALYSIS"="Forecast"])
In these formulas, the SUM function is used in combination with the OPENING
PERIOD, CLOSING PERIOD and ANCESTOR functions to generate a rolling period
value.
VIRTUALCHILD Function
Use
The VIRTUALCHILD returns a reference to the virtual child of a specified member. It
takes one argument, which is a reference to the member whose virtual child you want to
refer to. The member cannot be a leaf member because leaf members do not have virtual
children.
Commonly Used Functions Using String Functions in a Bracketed Member Reference 155
Syntax
VIRTUALCHILD(<memberCode>)
Example
See PARENT.
Data Options
Introduction
There are two ways to load data in SAS Financial Management in the Periods
workspace:
load new data to this cycle
load model data to this cycle
158 Loading Data and the Source Dimension Chapter 10
Modeling Formula
Sales = ["ACCOUNT"="Price"]*["ACCOUNT"="Units Sold"]*-1
Formula Scope
["ANALYSIS"="Budget"]
["ANALYSIS"="Forecast"]
Facts
For the Forecast Analysis member, facts from the Jan 2013 through Mar 2013 Budget
Analysis member are loaded to the same time periods for the Forecast Analysis member.
The data for the Budget Analysis member to be loaded to the Forecast Analysis member
is as follows:
The Budget data is loaded to the Forecast Analysis member, selecting to load to the
Base Source member. Following the load, the values for Units Sold are modified via
Data Entry to the following values:
Jan 2013: 125
Feb 2013: 150
Mar 2013: 175
160 Loading Data and the Source Dimension Chapter 10
The data-entry table for the modified Units Sold values for the Forecast Analysis
member is shown below:
Results
The expected results for Sales for the Forecast Analysis member are computed as
follows:
Jan 2013: 10.00 * 125.00 * -1 = (1,250.00)
Feb 2013: 10.00 * 150.00 * -1 = (1,500.00)
Mar 2013: 10.00 * 175.00 * -1 = (1,750.00)
Q1 2013: (1,250.00) + (1,500.00) + (1,750.00) = (4,500.00)
The read-only table displays the following results:
In this example, the Sales account’s values do not match the expected results. This is
due to the fact that the data was loaded to the Base Source member for the Forecast
Analysis dimension. After the data is loaded, modifications to the Units Sold account
through the Form are automatically stored in the BaseForm Source member.
Interactions with Load and Delete Data Options Loading Data and the Source Dimension 161
The contributing data records for the Units Sold account for the Total Source member
for Jan 2013 show two things:
A value of 100 is in the Base Source member.
A net value of 25 is in the BaseForm source member.
Facts entered via a Form are always written to the BaseForm Source member. In this
example, the modified value of 125.00 entered for Source Total results in the difference
between the existing amount and the modified amount to be written to the BaseForm
Source member. Therefore, the value of 125.00 entered for Jan 2013 was netted against
the 100.00 value currently stored in the Base member. As shown in contributing data,
the 100 is negated in the BaseForm Source member, leaving a net value of 25.00 stored
for the BaseForm Source member.
Modeling formulas treat the Source dimension in the same way that they treat all
other dimensions. In each calculation, the Source member of all the input crossings is
the Source member of the output crossing, unless you override this behavior in the
formula expression. A calculation for a Base crossing gets its inputs from Base crossings,
and so on. Modifying the table to include the Source dimension more clearly illustrates
how the values for the Units Sold Account member were stored and the values for Jan
2013 Sales are calculated:
Based on where the data is stored, the results for the Sales account are currently
computed as follows:
Jan 2013: (10.00 * 100.00 * -1) + (0.00 * 25.00 * –1) = (1,000.00)
Feb 2013: (10.00 * 125.00 * -1) + (0.00 * 25.00 * –1) = (1,250.00)
Mar 2013: (10.00 * 150.00 * -1) + (0.00 * 25.00 * –1) = (1,500.00)
Q1 2013: (1,000.00) + (1,250.00) + (1,500.00) = (3,750.00)
It is important to consider the target member of the Source dimension for loading
data where driver formulas and modeling formulas are involved. In order to achieve the
originally expected results of (1,250.00), (1,500.00), (1,750.00) and (4,500.00), the
formula expression should be modified as follows:
Sales = ["SOURCE"="Base"]["ACCOUNT"="Price"]
*(["SOURCE"="Base"]["ACCOUNT"="Units
Sold"]+["SOURCE"="BaseForm"]["ACCOUNT"=
"Units Sold"])*-1
162 Loading Data and the Source Dimension Chapter 10
Formula Scope
["SOURCE"="BaseForm"]
The results for Jan 2013 based on the revised formula expression are as follows:
Note that with modeling formulas, it might also be necessary to define a formula
scope to ensure the desired results. If the formula scope is limited to the BaseForm
member of the Source dimension, the resulting table appears as displayed above.
Without formula scope on the Source dimension, a modeling formula runs for each
Source member that is a leaf member, as displayed below:
As illustrated, selecting the Base Source member as the target for loading data might
require additional maintenance for driver formulas and modeling formulas. We
recommend this only when you need to keep data that is loaded from an external source
or a model separate from data that is entered through Forms.
Interactions with Load and Delete Data Options Loading Data and the Source Dimension 163
Formula
Sales = ["ACCOUNT"="Price"]*["ACCOUNT"="Units Sold"]* -1
Formula Scope
["ANALYSIS"="Budget"]
["ANALYSIS"="Forecast"]
164 Loading Data and the Source Dimension Chapter 10
Facts
For the Forecast Analysis member, facts from the Jan 2013 through Mar 2013 Budget
Analysis member are loaded to the same time periods for the Forecast Analysis member.
The data for the Budget Analysis member to be loaded to the Forecast Analysis member
is as follows:
After the data load is loaded to the Forecast Analysis member for the BaseForm
Source member, the values for Units are modified as follows:
Jan 2013: 100
Feb 2013: 200
Mar 2013: 300
The data-entry table for the modified Units values for the Forecast Analysis member
is shown here:
Results
The expected results for Sales are computed as follows:
Jan 2013: 15.00 * 100.00 * -1 = (1,500.00)
Feb 2013: 15.00 * 200.00 * -1 = (3,000.00)
Mar 2013: 15.00 * 300.00 * -1 = (4,500.00)
Q1 2013: (1,500.00) + (3,000.00) + (4,500.00) = (9,000.00)
Interactions with Load and Delete Data Options Loading Driver Formulas Facts to the Base Member of the Source Dimension 165
In this example, the values for the Sales account match the expected results. This is
because all the facts (whether loaded from another model or entered through a form) are
stored in the BaseForm Source member. The contributing data records for the Units
Sold account for Jan 2013 are as follows:
As evidenced in Scenario 2, selecting the BaseForm member as the target for loading
data proves to be the recommended approach where modeling formulas and driver
formulas are involved. This selection minimizes formula expression maintenance and
ensures formula accuracy.
results loaded within the same Source member. In contrast, driver formula facts loaded
to the Base member cannot be modified in the Base Source member.
Introduction
Driver formulas provide a mechanism to create data using the context of a data-entry
table. This chapter explains how driver formula results are created and provides
recommendations for form design.
Range of Execution
The following items define the range of execution for a driver formula:
formula scope (defined on the member).
writable analyses (defined in the form set).
writable crossings on the form set template after excluding crossings with hide
visibility rules and crossings removed via Filter Member Combinations.
the driver formulas included on the data-entry table in the form set.
driver formulas do not execute at TIME members which are locked in the cycle.
Effective with SAS Financial Management Studio 5.3, only drivers included on the
data-entry table are executed. This is a change in behavior from previous versions that
executed all driver formulas in a hierarchy, regardless of whether they were included on
the table or not.
With SAS Financial Management Studio 5.4 and later, drivers that are removed from
the table via Filter Member Combinations no longer execute. This change in behavior is
consistent with the requirement that a crossing must be navigable on the table in order
for the driver formula to execute.
168 What Triggers Execution of a Driver Formula Chapter 11
Two Actions
There are two ways to execute driver formulas:
entering data into a form.
selecting the Run driver formulas for this form set option in the Forms
workspace. This option triggers the execution of driver formulas for the entire
form set.
Note that selecting Refresh does not trigger the execution of driver formulas.
Driver Formulas That Are Triggered by the Run driver formulas for
this form set Option
The Run driver formulas for this form set option is required for the following
scenarios:
changes to global values such as exchange rates, PRATE or DRATE rates, and
formula expression inputs that are not in a given form.
changes to a driver formula expression after data input.
creation or deletion of a driver formula after data input.
loading data records that affect driver formulas.
formula inputs are not included on the table.
Form Design
Form design defines the scope for execution of driver formulas when you select the
Run driver formulas for this form set option. This option examines member
selection for all slicers, rows, and columns. Limiting the number of slicers and members
in a form limits the number of drivers that need to be executed. This improves
performance. To optimize the performance of the Run driver formulas for this form
set option, the following guidelines are recommended:
Limit the dimension members in rows, columns, and slicers to the members that
are required for data entry. Be sure to consider the Source and Trader dimensions.
Use a separate read-only table for data that is needed in a form for information
purposes only. For example, if you need to enter data for a budget, maintain the
Actual data in a separate read-only table in the same form.
Use Hide Visibility Rules or Filter Member Combinations to restrict the number of
crossings required to run driver formulas.
Note: Only driver formulas included on the data-entry table are executed. This is a
change in behavior from previous releases.
Delete Behavior with Run Driver Formulas for this Form Set Option
When there are existing facts, the Run driver formulas for this form set option
performs one of the following two actions depending upon the type of fact(s) that exist:
If the fact is a driver fact from the same form set, it deletes the existing fact and
replaces it with the newly executed driver fact.
If the fact is not a driver fact from the same form set (such as form data entry,
loading, or a previously executed driver fact from a different form set), the fact is
negated and the newly executed driver fact will result.
Note: Only driver formulas which were generated by this form set are deleted.
Overview
This chapter describes the factors that can affect performance of driver, modeling and
reporting formulas and the various options to improve performance. As described
earlier, each formula type was designed for a specific intent. Driver and Modeling
formulas are designed for data creation, whereas Reporting formulas are intended to
report on the results of data in the form of ratios and other calculations.
There are few scenarios for which modeling formulas are recommended. Modeling
formulas can be used for what-if analyses where inputs change frequently and results
are expected instantly. However, carefully consider the performance factors described
here. When possible, perform what-if analyses in a separate model to confine the
performance cost.
A modeling formula runs across an entire model. The difference is dramatic. A form
might have hundreds or thousands of writable crossings while a model might have
trillions or quadrillions.
A query for a driver formula’s results returns values based on facts that were stored
in the database after the last execution of the formula. Using driver formulas protects
against unwanted changes after a budget is approved. A driver formula does not execute
unless data is entered into a form or the Run driver formulas for this form set
action is used.
A modeling formula runs each time a user submits a query, so the results are always
based on the latest data and metadata. However, there is a performance cost. In many
cases, the inputs have not changed so there is no benefit to running the formula again.
The following tables illustrate the difference in the number of crossings for execution
of these two types of formulas. In this example, the modeling formula runs for 535
trillion cells while the driver formula is limited to 38,400 writable crossings.
Modeling Formula Scope:
Extending the example from above for driver formulas, the following table illustrates
the number of crossings for which the driver formula runs. Assume that there are 50
driver formulas in this model’s hierarchy but only 10 driver formulas are included on the
data-entry table. When a value is entered into a form for a single crossing, this entry
triggers all driver formulas in the table for the crossing for which the value was entered.
In this example, the number of accounts decreases from 30 (in the form set) to 10 (the
number of driver formulas on the table). The driver formulas will be executed for all
writable crossings on the form. In this example, entering a value in a form triggers the
execution of driver formulas for a total of 2,400 crossings.
The form set uses INTORG as the target hierarchy, and there are 16 INTORG
members. Therefore, the Run driver formulas for this form set action triggers
formula execution for 38,400 crossings: the number of writable crossings for one form
(12 Time periods * 20 Cost Centers) times the number of driver formulas (10) times the
number of target members (16).
Optimizing Formula Performance Managing Formulas for Performance 173
The following factors affect the number of crossings where a driver formula runs when
a user enters one numeric value in a form or when you select the Run Driver formulas
for this form set option:
number of driver formulas included on the data entry table
number of writable crossings for each dimension defined in the form set on the
data entry table
When you design a form set, limit the members in rows, columns, and slicers to
relevant members that require input. Data that is required in a form for informational
purposes should be displayed only in a separate read-only table. Use Visibility Rules to
restrict the number of crossings.
The writable crossings for the Analysis dimension are based on the Writable Analysis
Members selected in the Form Set. The writable crossings are further subset by a
formula’s scoping. After the formula’s scope is applied, the writable crossings are further
subset by the “selected” Analysis members. The Analysis members are selected through
member selection rules on the data-entry template in Microsoft Excel.
The following table compares the number of crossings where a modeling formula runs
with the number of crossings where a driver formula runs in the example just described.
Introduction
There are several factors that can affect the query and execution time for Reporting,
Modeling, and Driver formulas. Formula performance is primarily attributed to the
following:
Model Size
Formula Scope
Number of formula expression inputs
174 Managing Formulas for Performance Chapter 12
Model Size
The first step to understanding the performance impact of Modeling and Driver
formulas is determining the size of the model. Model size is defined by the number of
dimensions assigned to the model and the number of members in the selected
hierarchies for those dimensions. To determine the total number of crossings in a given
model, multiply the number of members in each dimension’s hierarchy. In the following
example, the model contains over 153 trillion crossings, computed as
9,189*118*83*45*43*21*7*6.
To reduce model size, we suggest using Custom Properties rather than custom
dimensions. An unlimited number of Custom Properties can be assigned to dimension
members without increasing the model size or impacting formula performance.
Based on the example above, modifying the Model and Cycle design to make the
Product custom dimension a Custom Property of the INTORG dimension results in an
adjusted cube size of approximately 17 billion crossings, computed as
118*83*45*43*21*7*6. That’s a reduction of more than 153 trillion crossings!
Formula Scope
Following consideration for the model design and size, the use of formula scoping is an
effective means of reducing the number of crossings where a formula executes.
Knowledge of where relevant data exists is crucial to maximizing the use of scoping,
which can dramatically improve the performance of modeling formulas. The most
common dimensions to consider for scoping are the Source, Trader, and Analysis
dimensions.
Optimizing Formula Performance Managing Formulas for Performance 175
To illustrate, refer to the example above with the model size of 153 trillion crossings.
Scoping for an individual modeling formula on the Source, Trader, and Analysis
dimensions reduces the number of crossings from 153 trillion to approximately 326
million.
Visibility Rules
The number of cells for which the “Run driver formulas for this form set” action
executes can be reduced dramatically by applying Visibility Rules. The following table
demonstrates the impact when visibility rules are utilized.
In the table above, the reduction of members in the Location dimension is due to
Visibility Rules created between the IntOrg and Location dimension. For each form,
there are approximately four valid locations that for each IntOrg. Applying visibility
rules removes non-relevant combinations between these two dimensions, thereby
reducing the total number of crossings where drivers could execute.
Note: Visibility Rules are most effective when the entire set of visibility rules
references members in no more than two dimensions. If it is necessary to include
members of more than two dimensions, performance time to run the query and run
drivers will be negatively impacted.
design results in the need to create additional reporting formulas in each dimension to
re-create rollup logic to include the values generated by other reporting formulas.
Note: It is strongly discouraged to utilize reporting formulas in this manner because
of performance implications. Also, we suggest limiting the number of calculated
members assigned as reporting formulas to no more than two dimensions, where
possible.
Introduction
This section applies the recommended performance measures on a step-by-step basis,
comparing execution time and cell count by step to illustrate the impact these measures
have on formula performance.
Example 1
Step 1: Create a query with no formulas.
Step 2: Add a Modeling formula with scoping on the Analysis dimension.
Step 3: Add additional scoping to the modeling formula.
Step 4: Modify formula expression to use multiple expressions per member.
The results of these steps are displayed below, followed by the details per step:
(["ACCOUNT"="2.3.1"]+["ACCOUNT"="2.3.2"]+["ACCOUNT"="2.3.3"]))
Formula
The formula is scoped to a single member of the Analysis dimension:
ANALYSIS: FORECAST_PRO - Member
Based on the use of the IF function in the formula expression, this formula is
considered Non-Distributive. The following information is provided:
Cube FormulasInfo
Planning Formulas formulas=1 chunks=1
[ACCOUNT].[2.1.3](all orgs) id=1117 rhs=[] distrib=[]
QueryStats Logging
java.lang.OutOfMemoryError
Due to the cell count size, adding a single Modeling formula with minimal scoping on
the Analysis dimension results in an Out of Memory error. In this situation, no values
are returned for the query.
The additional formula scoping renders a reasonable cell count with an execution time
of approximately 21 seconds:
Step
4.
While there is no change in the distributive property of the formula expression and
the cell count remains unchanged, the time to execute the query has been significantly
reduced.
2007-07-12 11:16:43,972 INFO [Query] Processed query in 1188ms
2007-07-12 11:16:43,972 INFO [QueryStats] Total: 00:01.188 (3040 cells),
Setup: 00:00.015, Fact Map Build (531 chunks): 00:00.015, Graph Build:
00:00.032, Graph Execution: 00:01.141, Reporting Graph Build: 00:00.000,
Reporting Graph Execution: 00:00.000, Fact Processing
(tot/exc/skip/ice/rel) (60235/0/59760/0/303): 00:00.000
Graph (15 nodes/7136320 cells): Accounting 13/6373600, LeafFormula
2/762720
This example illustrates how the combined use of formula scoping and multiple
expressions per member can render queries with execution times virtually equal to that
of queries containing no formulas.
Example 2
Step 1: Create a query with no formulas.
Step 2: Add a Distributive Modeling formula with multiple inputs and cross-
dimensional references.
Step 3: Modify Account hierarchy to reduce formula expression inputs.
Step 4: Remove cross-dimensional references.
The results of these steps are displayed below, followed by the details per step.
Step
1.
182 Applying Performance Improvements Chapter 12
Despite its distributivity and scoping, Query Stats Logging shows that query
execution time is now 1.02 minutes.
2007-07-12 12:37:30,771 INFO [Query] Processed query in 62732ms
2007-07-12 12:37:30,771 INFO [QueryStats] Total: 01:02.732 (2240 cells),
Fact Map Build (195 chunks): 00:00.141, Graph Build: 00:00.000, Graph
Execution: 01:02.575, Reporting Graph Build: 00:00.000, Reporting Graph
Execution: 00:00.000, Fact Processing (tot/exc/skip/ice/rel)
(160720/0/160120/0/600): 00:00.016
Graph (10 nodes/75354440 cells): Accounting 9/65937032, LeafFormula
1/9417408
the INTORG and COSTCTR dimensions are considered distributive. The revised
formula and resulting CubeFormulasInfo Logging detail are displayed below:
Expression
["ACCOUNT"="03"]+["ACCOUNT"="new rollup"]
Scope
INTORG: 75 - Leaf descendants of member if any, otherwise Member
INTORG: 20 - Leaf descendants of member if any, otherwise Member
INTORG: 40 - Leaf descendants of member if any, otherwise Member
INTORG: 17 - Leaf descendants of member if any, otherwise Member
INTORG: 63 - Leaf descendants of member if any, otherwise Member
INTORG: 64 - Leaf descendants of member if any, otherwise Member
INTORG: 65 - Leaf descendants of member if any, otherwise Member
COSTCTR: BAL - Leaf descendants of member if any, otherwise Member
COSTCTR: 1000 - Leaf descendants of member if any, otherwise Member
COSTCTR: 1001 - Leaf descendants of member if any, otherwise Member
COSTCTR: 1002 - Leaf descendants of member if any, otherwise Member
COSTCTR: 100300 - Leaf descendants of member if any, otherwise Member
COSTCTR: 100400 - Leaf descendants of member if any, otherwise Member
COSTCTR: 1100 - Leaf descendants of member if any, otherwise Member
COSTCTR: 15 - Leaf descendants of member if any, otherwise Member
COSTCTR: 20 - Leaf descendants of member if any, otherwise Member
COSTCTR: 25 - Leaf descendants of member if any, otherwise Member
COSTCTR: 30 - Leaf descendants of member if any, otherwise Member
COSTCTR: 35 - Leaf descendants of member if any, otherwise Member
COSTCTR: 40 - Leaf descendants of member if any, otherwise Member
COSTCTR: 45 - Leaf descendants of member if any, otherwise Member
COSTCTR: 50 - Leaf descendants of member if any, otherwise Member
COSTCTR: 55 - Leaf descendants of member if any, otherwise Member
COSTCTR: 60 - Leaf descendants of member if any, otherwise Member
COSTCTR: 65 - Leaf descendants of member if any, otherwise Member
COSTCTR: 70 - Leaf descendants of member if any, otherwise Member
COSTCTR: 75 - Leaf descendants of member if any, otherwise Member
COSTCTR: 80 - Leaf descendants of member if any, otherwise Member
COSTCTR: 85 - Leaf descendants of member if any, otherwise Member
COSTCTR: 90 - Leaf descendants of member if any, otherwise Member
COSTCTR: 95 - Leaf descendants of member if any, otherwise Member
COSTCTR: NEW - Leaf descendants of member if any, otherwise Member
Logging CubeFormulasInfo
Planning Formulas formulas=1 chunks=1
[ACCOUNT].[3530000899](Distrib test) id=345 RefsRollup rhs=[]
distrib=[1_SOURCE,3_COSTCTR,4_INTORG,5_TRADER,6_FOB,7_LOCATION]
["ACCOUNT"="03"]+["ACCOUNT"="new rollup"]
186 Applying Performance Improvements Chapter 12
The resulting revised formula expression significantly improves query execution time
as displayed below in the QueryStats Logging information:
2007-07-12 12:47:34,333 INFO [Query] Processed query in 593ms
2007-07-12 12:47:34,333 INFO [QueryStats] Total: 00:00.593 (2240 cells),
Fact Map Build (71 chunks): 00:00.015, Graph Build: 00:00.000, Graph
Execution: 00:00.578, Reporting Graph Build: 00:00.000, Reporting Graph
Execution: 00:00.000, Fact Processing (tot/exc/skip/ice/rel)
(160720/0/160120/0/600): 00:00.000
Graph (4 nodes/1360520 cells): Accounting 3/907760, LeafFormula 1/452760
13 Troubleshooting
C H A P T E R
Introduction
This chapter discusses the tools and information available in the following locations to
investigate invalid calculated members and formula results for valid calculated
members:
SAS Financial Management Studio
the Microsoft Excel Add-in
web-based data-entry forms
Formulas tab. Select Show Formulas. A warning icon is displayed next to any
calculated member that contains an invalid formula expression.
In the example provided above, the following warning is displayed on the formula
expression that refers to that Account because “Total Salaries” is not in the model’s
Account hierarchy:
Introduction
If a formula returns an unexpected value, follow these steps to determine how the
value was derived.
After expanding the table to display leaf crossings, it is apparent that the formula
inputs were entered at different Products (Simulation and Arcade) resulting in a value
of zero for Account C.
Troubleshooting Web Data-Entry Forms 191
Note that only driver formula results actually generate a fact that is stored and
viewable via Contributing Data. Modeling and Reporting formulas are computed on
demand. Therefore, their results are not stored as facts.