Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

if else then

Good morning friends, I am new in QlikView, but I need help, would put 2 expression in different conditions??

  model we use follows:

=IF(Variable1>='0,25',(If(Tipo='4.01-ELETROFISIOLOGICOS',if(v1>'0',(sum(HM_CBHPM)*v1+sum(UCO_CBHPM)*',24'+sum(Filme_CBHPM)*'19,40'),(sum(HM_CBHPM)*Variable1+sum(UCO_CBHPM)*',24'+sum(Filme_CBHPM)*'19,40')))))

=if(Variable1>='0,25',(If(Tipo='4.02-ENDOSCOPICOS',if(v1>'0',(sum(HM_CBHPM)*v1+sum(UCO_CBHPM)*',24'+sum(Filme_CBHPM)*'19,40'),(sum(HM_CBHPM)*Variable1+sum(UCO_CBHPM)*',24'+sum(Filme_CBHPM)*'19,40')))))

Tks ( Obrigado )

Luís Rocha

1 Solution

Accepted Solutions
Not applicable
Author

The same one like before, because I only see the different in the second if-clause, where one time Tipo='4.01-ELETROFISIOLOGICOS' and the other time Tipo='4.02-ENDOSCOPICOS'. The other parts are equal.

So I only add this differenz with an OR-clause in the second if-clause. I have rearrange the expression, so that you have a better look. The bold part is the "then"-part and the italic part is the "else"-part.

Expression 1:

=IF(Variable1>='0,25',

     (If(Tipo='4.01-ELETROFISIOLOGICOS',

if(v1>'0',

     (sum(HM_CBHPM)*v1+sum(UCO_CBHPM)*',24'+sum(Filme_CBHPM)*'19,40'),

     (sum(HM_CBHPM)*Variable1+sum(UCO_CBHPM)*',24'+sum(Filme_CBHPM)*'19,40')
))))

Expression 2:

=if(Variable1>='0,25',

      (If(Tipo='4.02-ENDOSCOPICOS',

if(v1>'0',

     (sum(HM_CBHPM)*v1+sum(UCO_CBHPM)*',24'+sum(Filme_CBHPM)*'19,40'),  

     (sum(HM_CBHPM)*Variable1+sum(UCO_CBHPM)*',24'+sum(Filme_CBHPM)*'19,40')

))))

New expression

=IF(Variable1>='0,25',

      (If(Tipo='4.01-ELETROFISIOLOGICOS' or Tipo='4.02-ENDOSCOPICOS',

if(v1>'0',

     (sum(HM_CBHPM)*v1+sum(UCO_CBHPM)*',24'+sum(Filme_CBHPM)*'19,40'),

                  (sum(HM_CBHPM)*Variable1+sum(UCO_CBHPM)*',24'+sum(Filme_CBHPM)*'19,40')
))))

Maybe, I have misunderstood you. Perhaps you have a small application, where the problem is obvious.

Regards Vicky

View solution in original post

5 Replies
Not applicable
Author

hi,

maybe you need to put the second one with OR in the first ona, f.e.

=IF(Variable1>='0,25',(If(Tipo='4.01-ELETROFISIOLOGICOS' OR Tipo='4.02-ENDOSCOPICOS',if(v1>'0',(sum(HM_CBHPM)*v1+sum(UCO_CBHPM)*',24'+sum(Filme_CBHPM)*'19,40'),(sum(HM_CBHPM)*Variable1+sum(UCO_CBHPM)*',24'+sum(Filme_CBHPM)*'19,40')))))

I could not find any more differences between the two expressions.

regards

Vicky

Not applicable
Author

thanks for the help, but how ELSE use the expression?

Not applicable
Author

The same one like before, because I only see the different in the second if-clause, where one time Tipo='4.01-ELETROFISIOLOGICOS' and the other time Tipo='4.02-ENDOSCOPICOS'. The other parts are equal.

So I only add this differenz with an OR-clause in the second if-clause. I have rearrange the expression, so that you have a better look. The bold part is the "then"-part and the italic part is the "else"-part.

Expression 1:

=IF(Variable1>='0,25',

     (If(Tipo='4.01-ELETROFISIOLOGICOS',

if(v1>'0',

     (sum(HM_CBHPM)*v1+sum(UCO_CBHPM)*',24'+sum(Filme_CBHPM)*'19,40'),

     (sum(HM_CBHPM)*Variable1+sum(UCO_CBHPM)*',24'+sum(Filme_CBHPM)*'19,40')
))))

Expression 2:

=if(Variable1>='0,25',

      (If(Tipo='4.02-ENDOSCOPICOS',

if(v1>'0',

     (sum(HM_CBHPM)*v1+sum(UCO_CBHPM)*',24'+sum(Filme_CBHPM)*'19,40'),  

     (sum(HM_CBHPM)*Variable1+sum(UCO_CBHPM)*',24'+sum(Filme_CBHPM)*'19,40')

))))

New expression

=IF(Variable1>='0,25',

      (If(Tipo='4.01-ELETROFISIOLOGICOS' or Tipo='4.02-ENDOSCOPICOS',

if(v1>'0',

     (sum(HM_CBHPM)*v1+sum(UCO_CBHPM)*',24'+sum(Filme_CBHPM)*'19,40'),

                  (sum(HM_CBHPM)*Variable1+sum(UCO_CBHPM)*',24'+sum(Filme_CBHPM)*'19,40')
))))

Maybe, I have misunderstood you. Perhaps you have a small application, where the problem is obvious.

Regards Vicky

Not applicable
Author

sorry, but I need to sequence in IF, ex:

=IF(Variable1>='0,25',If(Tipo='4.01-ELETROFISIOLOGICOS',if(v1>'0',(sum(HM_CBHPM)*v1+sum(UCO_CBHPM)*',24'+sum(Filme_CBHPM)*'19,40'),sum(HM_CBHPM)*Variable1+sum(UCO_CBHPM)*',24'+sum(Filme_CBHPM)*'19,40')))

=IF(Variable1>='0,25',If(Tipo='4.02-ENDOSCOPICOS',if(v1>'0',(sum(HM_CBHPM)*v1+sum(UCO_CBHPM)*',24'+sum(Filme_CBHPM)*'19,40'),sum(HM_CBHPM)*Variable1+sum(UCO_CBHPM)*',24'+sum(Filme_CBHPM)*'19,40')))

expression, works, only that when I change the v1 '4.01-ELETROFISIOLOGICOS 'changes also for type = ''4.02-ENDOSCOPICOS and it can not, the Variables V1 and V2 are independent.

thanks for the help

Not applicable
Author

Good morning,

But I can not see the second variables? Or is the second expression with Variable2 and v2?