What is most computational demanding on the system, if statement or max formula

Options

Hi,
I have a question, I have encountered in some of our models, where we want to limit a value to be 0 if it is negative. The way we have done this so far is by making an if statement so:

if A > 0 then A else 0.

Since Anaplan has Max, I thought this could be used, at least to make it easier to follow.

The big question is then, if it is more efficient to use the max formula, rather than creating if statement to check if it is positive or negative. So which option is the most computational demanding on the system given:

A: Need to check if another line item is positive, if not then take 0.

B: Need to check if a longer calculation is positive, if not then 0

C: Need to check if a sum from a list is positive, if not then 0.

I would imagine that the max formula would be more efficient, since it only needs to calculate once, where I imagine that the if would have to calculate first to check the statement, if that is positive then calculate it again to add the value. But would love to get better insight on this matter.

Best regards

Morten

Best Answer

  • VanshikaSingh
    Options

    @Mobo ,
    both takes same calculation on less scale of data.
    But nested if else statement takes more computation compared to max in case of large scale data.
    so you can use max in this case.

Answers

  • @Mobo,

    I would also say using MAX function to force negative numbers to zero instead IF ELSE statements. But not able to find any supporting documentation or articles on community. Also you can open a Support ticket to get that answered quickly, would be helpful to get documentation or article on which functions has good or bad impact on model's performance.