Formulas
A Formula is a typed expression in a small modelling
language modelled loosely on Microsoft Excel. Formulas are used by
CalculatedField and
Calculation to compute values from other fields and
named values.
Build expressions with Python operators or with the helper functions in
daitum_model.formulas:
import daitum_model.formulas as formulas
from daitum_model.formula import CONST
total = products["price"] * products["quantity"] # Formula
is_expensive = products["price"] > CONST(100) # Formula
summary = formulas.SUM(products["price"]) # Formula
The Formula Class
- class Formula(data_type, formula_string)[source]
Bases:
Buildable,OperandRepresents a formula used in calculations or data processing.
- data_type
The type of data that the formula returns.
- Type:
Built-in Formula Functions
The daitum_model.formulas submodule provides every built-in formula
function.
Formula Reference:
- ABS
- AND
- ARRAY
- ARRAYMAX
- ARRAYMIN
- AVERAGE
- BINOMDIST
- BINOMINV
- BITAND
- BITMASK
- BITMASKSTRING
- BITOR
- BLANK
- CEILING
- CHAR
- CHOOSE
- CONST
- CONTAINS
- COS
- COUNT
- COUNTBLANKS
- COUNTDUPLICATES
- DATE
- DATETIME
- DAY
- DAYSBETWEEN
- DISTINCT
- DISTRIBUTE
- EOMONTH
- EXP
- FILTER
- FIND
- FINDDUPLICATES
- FLOOR
- FROMTIMEZONE
- GAMMADIST
- GAMMAINV
- GET
- HOUR
- HOURSBETWEEN
- IF
- IFBLANK
- IFERROR
- INDEX
- INTEGER
- INTERSECTION
- ISBLANK
- ISERROR
- LEFT
- LEN
- LOG
- LOOKUP
- LOOKUPARRAY
- LOWER
- MATCH
- MAX
- MEDIAN
- MIN
- MINUTE
- MOD
- MONTH
- MONTHSBETWEEN
- NEXT
- NORMDIST
- NORMINV
- NOT
- OR
- PLUSDAYS
- PLUSMINUTES
- POWER
- PREV
- RANK
- RIGHT
- ROUND
- ROW
- ROWS
- ROWVECTOR
- SECOND
- SETTIME
- SIN
- SIZE
- STDEV
- SUM
- TEXT
- TEXTJOIN
- TIME
- TOMAP
- TOTIMEZONE
- TRIM
- UNION
- UPPER
- VALUES
- WEEKDAY
- WEIBULL
- YEAR