cancel
Showing results for 
Search instead for 
Did you mean: 

Formula Expression contained Variable

treyscheid
Rocketeer

When using formula builder (in insight formulas) I often use the same logic or references multiple times. Excel has the LET function to define a variable contained within the scope of the formula. This improves maintainability and legibility. Does this type of function or feature exist?

Here is a simplistic use case; but, often there may be need for multiple variables and nested variables. 

/* current */
if(
    isNull(sum(SCHEMA.TABLE.COL)),
    0,
    sum(SCHEMA.TABLE.COL)
)

/* desired */
let(var_name, 
    sum(SCHEMA.TABLE.COL), 
    if(
        isNull(var),
        0,
        var
    )
)

 

0 REPLIES 0