Solved

# what is difference between Fix and IF?

Posted on 2009-07-08
1,985 Views
what is difference between Fix and IF?
0
• 3

LVL 5

Accepted Solution

garycris earned 500 total points
ID: 24803865
Both are used to focus your calculation to a subset of data in your cube

The FIX&ENDFIX command block restricts database calculations to a subset of the database. All commands nested between the FIX and ENDFIX statements are restricted to the specified database subset.

This command is useful because it allows you to calculate separate portions of the database using different formulas, if necessary. It also allows you to calculate the sub-section much faster than you would otherwise.

So if I say
FIX ("Jan");
"Margin" = "Sales" - "COGS";
ENDFIX;

When I run this calc, Margin will only be calculated for the month of January.

'IF' Performs conditional tests within a formula. Using the IF statement, you can define a Boolean test, as well as formulas to be calculated if the test returns either a TRUE or FALSE value.

So similar to above, I can say

IF(@ISMBR("Jan"));
"Margin" = "Sales" - "COGS";
ELSE
"Margin" = #MISSING;
ENDIF;

In this case I test to see if the member being calculated is Jan, if it is then I run the Margin formula, otherwise I set Margin to Missing (NULL).

If your thinking they do the same thing, in some ways they do, but in other ways they allow you to do different things.  FIX assumes you know explicitly what you want to focus on, IF allows you to test conditions and then decide whether to calculate.  You might have a formula that calculates bonuses and you could have something like
IF ("Sales" > 2000000)
"Bonus" = "Sales" * .015;
ELSEIF ("Sales" > 1000000)
"Bonus" = "Sales" * .01;
ELSE
"Bonus" = #MISSING;
ENDIF;

In this case if Sales is not greater 1 million then there is no bonus. If it is greater than 1 Mil but less than 2 mil, then there is a 10% bonus and if greater than 2 mil, then there is a 15% bonus.

There are also performance considerations.
Using IF on a large Sparse dimension can be bad as it has to cycle through all the data blocks in the Index file to see if they meet the criteria.  Generally speaking a FIX is more efficient on Sparse dim.
IF can be more efficient on a Dense dim opposed to multiple FIX statements because the IF allows Essbase to evaluate the block once while it is in memory rather than have to move it in and out of memory multiuple times.
0

Author Closing Comment

ID: 31600995
thanks
0

Author Comment

ID: 24825577
thanks
0

Author Comment

ID: 24825580
thanks
0