Rule Rules - ONLY write rules when necessary.

cbriscoe
New Contributor III

Rules TIP  - ONLY write / use Rules when necessary.

OneStream projects should not be a contest to see who is better at writing complex rules.

If you must write rules please remember:

  • Unless specified, the calculation will run on Base Entities AND each Parent Entity. Use these lines almost always in your rules.
  • For Base entities only use: If Not api.entity.HasChildren Then
  • For Parent entities only use: If api.entity.HasChildren Then
  • For ALL entities: api.Data.Calculate(“A#Account1 = A#Account2”)
  • There are up to 6 calculation operations in the Consolidation process per Entity.

Conditional statements can be added to formulas to limit which Consolidation calculation processes will do something for this formula.

For Local currency only: If Api.Cons.IsLocalCurrencyforEntity Then

For Translated currency only: If api.Cons.IsForeignCurrencyForEntity Then

For Parent-Child Relationship levels: Api.Cons.IsRelationshipLevel returns True for Consolidation level being OwnerPreAdj, Share, Elimination or OwnerPostAdj.

For best performance, use Remove Functions – Zero and No Data

  • Can be used in a Member Formula or a Business Rule.
  • RemoveZeros Function removes data cells with cell amount of 0 from data buffer AND removes data cells with cell status of NoData from data buffer.
  • RemoveNoData Function ONLY removes data cells with cell status of NoData from data buffer (data cells in a Data Unit).
  • When declaring variables in a member formula or business rule, ensure the variables are within the calculation conditions to avoid unnecessary code execution.

cbriscoe_0-1712315199764.png

TIP  2 - Don’t Stack api.Data.Calculate Functions.

Let's say we need to calculate data for the dimension members below. What shall we do?

cbriscoe_1-1712315428947.png

  1. Use a filter; don’t be afraid to create alternate groupings.
  2. Use member filters to perform the same calculation logic for multiple members.
  3. Use the hierarchy to drive calculations.
  4. Reduces the number of times the Data Unit is called into memory and the number of times data is written back to the Cube.
  5. Avoid referencing a user's workflow POV in stored formulas: Finance rules can and often do run outside the workflow.

cbriscoe_2-1712315428955.png

Instead of the above - do the list below.

cbriscoe_3-1712315468773.png

For more information:

OneStream Finance Rules and Calculations Handbook. 

Level 2: Financial Model Rules course.

2 ACCEPTED SOLUTIONS

osdevadmin
New Contributor III

thank you sir, most important thing to remember

View solution in original post

Krishna
Valued Contributor

@cbriscoe - Thanks. 

My 2 Cents

- You can also use Finance Business Rule vs Creating more member formula because it might impact the consolidation time.

- Avoid using api.data.calulate inside the for loop, instead use the DBCL.

Thanks
Krishna

View solution in original post

3 REPLIES 3

osdevadmin
New Contributor III

thank you sir, most important thing to remember

Krishna
Valued Contributor

@cbriscoe - Thanks. 

My 2 Cents

- You can also use Finance Business Rule vs Creating more member formula because it might impact the consolidation time.

- Avoid using api.data.calulate inside the for loop, instead use the DBCL.

Thanks
Krishna

cbriscoe
New Contributor III

I like it. True too.