Skip to Content

Mixing two "IF" fomulas on SAP Analytics Cloud - Data action

I'm trying to create a logical function mixing "IFs" from two dimensions with no success.

I want to calculate the expected harvest of a vineyard that depending on two categories: the grape color (red or white) and the last year of rental agreement.

I have an account-dimension with the "Year of agreement" as a measure

and a generic-dimension with a grape color as an attribute

The two "IFs" functions work perfectly separately. However when I try to combine them, I get validation errors like: "The operator 'AND' can not be used in an IF function"

this is the script of the two separate IFs:

IF ( RESULTLOOKUP([d/account]="AGGRMNT_YEAR") - RESULTLOOKUP([d/Date]=%Current_Year%)) >0
IF [d/VINEYARD].[p/Color]="RED"

Can you please help me to use both of them as a condition for my data action?

Thanks for helping!

PS: attached one of my unsuccessful trial out of many

red.png (34.6 kB)
Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on Jul 15, 2020 at 10:56 AM

    You can't have multiple Master data filters in IF conditions...
    Multiple conditions are very tricky.

    Yes, It is very frustrating and unintuitive...

    and it's explained in help documentation here:

    Don't fully get your requirement but try to nest the IF statements, or use memberset and variablemember untill you get there...

    IF [d/VINEYARD].[p/Color]="RED" THEN
    IF ( RESULTLOOKUP([d/account]="AGGRMNT_YEAR") - RESULTLOOKUP([d/Date]=%Current_Year%)) >0
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 24, 2020 at 02:13 PM

    What I understood from your demand, I would do like this.

    Assuming cars are the color of grapes "attribute".

    Quantity is your measure "Year of agreement".

    • Click in Add Measure, Create Calculation.
    • In Type select aggregation.
    • In operation the type of aggregation "Sum, Average".
    • In measure the Year of agreement.
    • Aggregation dimensions "color of grapes Attribute".
    • Click in conditional aggregation.
    • In dimension "color of grapes".
    • values or imput control "red".

    holp this helps

    if that's not what you need, let's talk more to understand the demand.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 24, 2020 at 05:24 PM

    thanks, it's not exactly what I need - the formula I use is very complex and needs a data action,
    the two "if" are the beginning of my formula but I cannot use them together.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.