cancel
Showing results for 
Search instead for 
Did you mean: 

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

dd5
Participant
0 Kudos

Hello
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

former_member186338
Active Contributor
0 Kudos

Sorry, but please explain calculation logic! I can see only 2 IF and nothing else...

Accepted Solutions (0)

Answers (3)

Answers (3)

JefB
Active Contributor

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:
https://help.sap.com/viewer/00f68c2e08b941f081002fd3691d86a7/release/en-US/afe93e3cf1414a7b8419baad1...

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

ENDIF
ENDIF
dd5
Participant
0 Kudos

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.

former_member186338
Active Contributor
0 Kudos

Have to repeat - explain the full logic!

former_member638291
Participant
0 Kudos

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.