Visokio website     Downloads     Video tutorials     KnowledgeBase  
Formulae: Use value as a parameter? - Visokio Forums
Formulae: Use value as a parameter?
  •     MartijnVisser January 9, 2013 8:01AM
    Hello - I have a dataset which is similar to this:

    Amount | Condition | Result
    145000 | <150000 | 0,30<br />145000 | >150000 | 0,20

    I'm trying to achieve the following IF statement:

    IF(
    Amount < 150000, Amount * Result
    Amount > 150000, (Amount-150000) * Result
    0
    )

    Is it possible to declare/use the value in the condition field as a a condition in the IF statement?

    Best, Martijn
  • 4 Comments
  •     tjbate January 9, 2013 2:51PM
    Martijn - Looks like the value in the field [Condition] is really two things, a threshold value (numeric 15,000) and an logical operator, either LT or GT?.

    If so, the question is how to include the logical operator within the data set as a cell value such that Omniscope correctly interprets it as a logical operator within a formula that uses the (row-dependent) logical operator, while avoiding circular references...

    Is this a correct statement of the issue?
  •     MartijnVisser January 10, 2013 2:55AM
    Hi! You are completely correct!
  •     paola January 10, 2013 10:17AM
    I will make two suggestions, based on the limited sample.
    Firstly, you can duplicate the Condition field in Field Organiser, then use Expand values operation, fixed width option, to separate Condition sign from Condition Value.
    New [Condition number] field should be formatted as number, so that you can use it for calculations.
    Following your sample literally, you would use formula:

    IF([Condition Sign]="<",
    [Amount]*[Result],
    ([Amount]-150000)*[Result])

    This formula will detect the sign, but will not evaluate whether [Amount] is really greater than [Condition].... The second formula will:

    IF([Amount]<[Condition Value],
    [Amount]*[Result],
    ([Amount]-150000)*[Result])


    It will do a better job if the condition is as simple as: compare the two values and apply always the same formula in one case, second formula in other. Please post a sample file if the situation is more complex than that, in which case you might want to use DECLARE function http://www.visokio.com/functions-guide/declare
  •     MartijnVisser January 17, 2013 2:53AM
    I've managed to perform the quick & dirty solution, while I'll look into the DECLARE function at a later time!

Welcome!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership

Tagged