Finance Rules

Getting Started with Finance Rules

Finance Business Rules are the most common rule type in OneStream. They execute during cube operations — calculations, translations, and consolidations — and give you full control over how data flows through the Finance Engine.
ℹ️Info
If you're new to OneStream Business Rules, start with Getting Started with Business Rules for general concepts, rule types, and the overall structure before diving into Finance-specific details here.

What Are Finance Rules?

Finance Business Rules are written as Shared Business Rules and applied to a Cube, or as Member Formulas on individual dimension members. When a cube operation runs (Calculate, Consolidate, Translate), the Finance Engine fires your rule for each Data Unit — the intersection of Entity, Scenario, Time, Consolidation member, and Parent.
The api.FunctionType property tells you which operation triggered the rule. Your rule should always check this value and branch accordingly.

Finance Function Types

FinanceFunctionTypeDescription
CalculateRuns additional logic during Entity calculation. The most commonly used function type.
CustomCalculateSimilar to Calculate but fires on a separate pass, useful for sequential logic.
TranslateRuns custom currency translation logic.
FxRateDetermines foreign exchange rates for any intersection.
ConsolidateShareCustom logic for calculating the Share (ownership) member.
ConsolidateEliminationCustom logic for calculating the Elimination member.
DynamicCalcAccountCalculates values on-the-fly without storing them.
MemberListProvides dynamic member lists at runtime.
DataCellCustom logic for individual data cell retrieval.
CalcDrillDownMemberFormulaProvides custom drill-down results for calculated members.
ConditionalInputControls whether users can input data at a given intersection.
ConfirmationRuleValidates data before certain operations.
💡Tip
Due to OneStream's sophisticated built-in translation and consolidation algorithms, most applications only require Member Formulas for the Data Unit Calculation Sequence (DUCS). Custom Business Rules for Translation, Share, and Intercompany Eliminations are not typically needed.

The Finance Rule Skeleton

Every Finance Business Rule is wrapped in a full VB.NET class with Imports, a Namespace, and a Main function. Here is the complete boilerplate:
1Imports System
2Imports OneStream.Shared.Common
3Imports OneStream.Shared.Wcf
4Imports OneStream.Finance.Engine
5Imports OneStream.Finance.Database
6
7Namespace OneStream.BusinessRule.Finance.MyRuleName
8  Public Class MainClass
9      Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As FinanceRulesApi, ByVal args As FinanceRulesArgs) As Object
10          Try
11              ' Your logic here
12
13              Return Nothing
14          Catch ex As Exception
15              Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
16          End Try
17      End Function
18  End Class
19End Namespace
Key elements:
  • si (SessionInfo) — Contains information about the current user session.
  • globals (BRGlobals) — A shared object that persists across Data Unit calculations within a single process. Useful for caching expensive lookups.
  • api (FinanceRulesApi) — The context-specific API for the current calculation. Provides access to data, dimensions, entities, and more.
  • args (FinanceRulesArgs) — Contains arguments about what triggered the rule, including FunctionType.
  • ErrorHandler.LogWrite — The standard OneStream pattern for catching and re-throwing exceptions with proper logging.
💡Tip
You don't need to memorize this boilerplate. OneStream pre-populates it when you create a new Business Rule in the application. Focus on the logic you write inside the Try block.

Rule Execution Flow

The following diagram shows how OneStream determines which logic to execute based on the operation type:
diagramFinance Rule Execution Flow

Loading diagram...

Your rule fires once per Data Unit, so always add guard conditions at the top to skip Data Units that don't need your logic. This is the single most impactful performance practice:
1If api.FunctionType = FinanceFunctionType.Calculate Then
2  ' Only fire for base entities at local currency
3  If api.Entity.IsBase AndAlso api.Cons.IsLocalCurrency Then
4      ' Your calculation logic here
5  End If
6End If
Continue with the rest of the Finance Rules guide series:
  • Understanding Data Units — Learn how OneStream breaks calculations into Data Units and how to write efficient guard conditions
  • Writing Calculations — Master stored calculation techniques, Calculate vs. CustomCalculate, and when to use Business Rules vs. Member Formulas
  • The Finance Rules API — Explore the Finance Rules API object, BRApi static class, and code sharing patterns