Performance
Number used as a yes/no flag
A 1/0 number used only as a yes/no flag should be a Boolean: it holds the same answer in about an eighth of the memory.
What MaxCheck detects
A Number line item whose formula is an IF that only returns 1 or 0, and whose readers only compare it (= 1, > 0). Skipped when its summary or time summary is Sum, when nothing reads it, when a reader adds, multiplies or sums it (a counter), or when a reader is outside the file.
Why it hurts
A Boolean holds the same yes/no in about an eighth of the memory, and reads as what it is. Comparing a number to 1 is one more calculation everywhere it's used.
Example
Taken from the rule's own test cases: formulas it must flag, and formulas it must not.
WarningFlags this(1/0 flag compared to 1)
- WarningActive FlagIF Status = 2 THEN 1 ELSE 0
- Referenced by: Revenue
- RevenueIF Active Flag = 1 THEN Sales ELSE 0
Fine (a counter that is summed)
- CountIF Active THEN 1 ELSE 0
- Referenced by: Total
- TotalCount[SUM: Map.Region]
How to fix
Make it a Boolean: drop the IF and keep the condition (IF Active THEN 1 ELSE 0 becomes Active). Change the readers from Flag = 1 to Flag.
- Severity
- WarningCounts toward the area score.
- Area
- Performance
- Runs in
- Full analysis only
- Rule ID
- P_NUMBERFLAG
- Version
- Rule 1.0.0, rule set 1.4.0
- Planual
- 2.02-07 Use Booleans instead of 1s & 0son Anaplan's Formulas page
Does your model do this?
Upload the line-items blueprint. This rule runs in the full analysis, with a work email.