Blog

Essbase calc script functions: a practical reference for Planning

Oracle's technical reference lists hundreds of calc script functions. On a real Planning (formerly PBCS) project, a few dozen do almost all the work. This reference groups those by the job they do, with the syntax and an example for each. Member names are examples; check the official reference for the full argument list of any function before relying on an edge case.

The skeleton every calc script shares

SET UPDATECALC OFF;
SET AGGMISSG ON;

FIX("FY27", "Forecast", "Working", @RELATIVE("Total_Entity", 0))
    "Revenue" (
        "Revenue" = "Units" * "Avg_Price";
    )
    AGG("Product");
ENDFIX

FIX limits the calculation to a slice, member blocks hold the formulas, and AGG or CALC DIM rolls the results up. Quote every member name.

Member set functions

These return lists of members, mostly for use inside FIX.

FunctionReturnsExample
@CHILDREN(mbr)The children of a member@CHILDREN("Q1")
@DESCENDANTS(mbr) / @IDESCENDANTS(mbr)Descendants, without / including the member@IDESCENDANTS("Total_Entity")
@RELATIVE(mbr, genLev)Descendants at a generation (positive number) or level (0 or negative)@RELATIVE("YearTotal", 0)
@LEVMBRS(dim, level)All members of a dimension at a level@LEVMBRS("Product", 0)
@GENMBRS(dim, gen)All members of a dimension at a generation@GENMBRS("Entity", 3)
@UDA(dim, "uda")Members with a user-defined attribute@UDA("Account", "Allocate")
@ATTRIBUTE(attrMbr)Base members with an attribute value@ATTRIBUTE("Retail")
@WITHATTR(dim, "op", value)Members whose attribute meets a condition@WITHATTR("Opened", ">", "2025")
@REMOVE(list1, list2)The first list minus the second@REMOVE(@RELATIVE("Total_Entity", 0), @UDA("Entity", "Closed"))
@LIST(m1, m2, …)A list, for functions that take one argument@LIST("Jan", "Feb", "Mar")

@RELATIVE(..., 0) is the one you'll write most: "every level 0 member under this one" is the safe default for calculations.

Condition functions

These return true or false, for IF inside a member block.

FunctionTrue when the current member…
@ISMBR(mbr or list)is one of the listed members
@ISLEV(dim, level) / @ISGEN(dim, gen)is at that level / generation
@ISCHILD(mbr) / @ISDESC(mbr)is a child / descendant of the member
@ISUDA(dim, "uda")has the user-defined attribute
"Commission" (
    IF (@ISUDA("Entity", "Sales_Office") AND @ISMBR(@RELATIVE("YearTotal", 0)))
        "Commission" = "Revenue" * "Commission_Rate"->"No Entity";
    ELSEIF (@ISUDA("Entity", "Partner"))
        "Commission" = "Revenue" * 0.05;
    ELSE
        "Commission" = #MISSING;
    ENDIF
)

Relationship and member functions

FunctionDoesExample
@PARENTVAL(dim, mbr)The value at the current member's parent@PARENTVAL("Entity", "Headcount")
@ANCESTVAL(dim, genLev, mbr)The value at an ancestor@ANCESTVAL("Entity", 2, "Rent")
@CURRMBR(dim)The member being calculated@CURRMBR("Entity")
@PARENT(mbr)The parent of a member@PARENT(@CURRMBR("Entity"))
@NAME(mbr)A member as a string@NAME(@CURRMBR("Entity"))
@MEMBER(string)A string as a member@MEMBER(@CONCATENATE("Alloc_", @NAME(@CURRMBR("Entity"))))
@CONCATENATE(s1, s2)Two strings joinedas above

@PARENTVAL is the usual way to allocate a parent's value down by a driver:

"Rent_Alloc" = @PARENTVAL("Entity", "Rent") * ("Floor_Space" / @PARENTVAL("Entity", "Floor_Space"));

Time and range functions

FunctionDoesExample
@PRIOR(mbr, n, range)The value n members earlier in a range@PRIOR("Closing_Balance", 1, @RELATIVE("YearTotal", 0))
@NEXT(mbr, n, range)The value n members later@NEXT("Units", 1, @RELATIVE("YearTotal", 0))
@SUMRANGE(mbr, range)The sum over a range@SUMRANGE("Revenue", "Jan":"Mar")
@AVGRANGE(skip, mbr, range)The average over a range, skipping missing or zero values as told@AVGRANGE(SKIPMISSING, "Headcount", @RELATIVE("Q1", 0))
@MAXRANGE / @MINRANGEThe largest / smallest value in a range@MAXRANGE("Price", @RELATIVE("YearTotal", 0))

A roll-forward is the textbook case:

"Opening_Balance" (
    IF (@ISMBR("Jan"))
        "Opening_Balance" = "Closing_Balance"->"Dec"->&PriorYear;
    ELSE
        "Opening_Balance" = @PRIOR("Closing_Balance", 1, @RELATIVE("YearTotal", 0));
    ENDIF
)

The January case needs its own branch because @PRIOR doesn't cross into the previous year's member of the Years dimension.

Math and variance functions

FunctionDoes
@ROUND(expr, digits)Rounds; negative digits round to tens, hundreds…
@ABS(expr)Absolute value
@VAR(m1, m2)Variance, respecting the expense reporting tag of the account
@VARPER(m1, m2)Percentage variance, also respecting the expense tag

@VAR and @VARPER matter because a cost coming in under budget is good news: they flip the sign for accounts tagged as expenses. The variance analysis guide covers them in depth.

Cross-cube functions

FunctionDoes
@XREF(alias, mbrs…)Reads a value from another cube through a location alias
@XWRITE(expr, alias, mbrs…)Writes a value to another cube
"Headcount" = @XREF(WorkforceCube, "Headcount", "Total_Grade");

Both are convenient and both are slow at volume. For large movements between cubes, a data map or Smart Push is usually the better tool.

Block and data commands

CommandDoes
DATACOPY "Budget" TO "Forecast";Copies data and creates the target blocks
CLEARDATA "Forecast";Sets values to #MISSING, keeps the blocks
CLEARBLOCK EMPTY;Removes blocks that contain only #MISSING (also ALL, UPPER, NONINPUT)
AGG("Entity", "Product");Aggregates sparse dimensions, ignoring formulas on upper members
CALC DIM("Account");Calculates a dimension, including member formulas

SET commands worth knowing

CommandUse
SET UPDATECALC OFF;Calculate every block in scope, not just the ones Essbase marked as changed. Usual in Planning rules
SET AGGMISSG ON;Aggregate #MISSING values so a cleared child clears its parent
SET CREATEBLOCKONEQ ON;Create blocks when a sparse member is assigned the result of an equation
SET CREATENONMISSINGBLK ON;Create blocks for any non-missing result. Powerful and slow; keep the FIX tight
SET EMPTYMEMBERSETS ON;Stop the calculation when a member set in a FIX is empty, instead of calculating everything
SET CALCPARALLEL n;Calculate with several threads
SET HYBRIDBSOINCALCSCRIPT FULL;Let the calc script use hybrid aggregation for dynamic sparse members; NONE turns it off

SET HYBRIDBSOINCALCSCRIPT comes up often in searches. It only matters on a hybrid cube. With FULL, a calc script can read dynamic upper-level sparse values computed at query time. With NONE, it behaves like a traditional block storage calculation. If a calc script returns different results from a form showing the same intersection, check this setting first. The ASO, BSO and hybrid comparison explains why.

Where EPM Agent fits

EPM Agent's build agents write business rules as readable specifications from the project's reviewed requirements, then compile them into the application's native format, so the intent behind a formula stays visible next to the code. See how artifact builds work, or the companion guide on business rule errors.

See EPM Agent on a project like yours.

A fictive engagement end to end: a meeting, the knowledge it creates, and the artifacts built from it.