Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
imoratal
Creator
Creator

Error with function IF----VERY IMPORTANT

I have an error and I don't know the solution:

Sum(If(A='1' and B='2',C/2),(A='1' and B='3',C/4))

Labels (1)
7 Replies
Not applicable

Your second condition needs to be a new if

Sum(if(A='1' and B='2',C/2, if (A='1' and B='3',C/4))

imoratal
Creator
Creator
Author

I have the error again. My function is:



Sum

(If(ApartadoVta='M2' and Calidad='2',([Cantidad Pedido]*CosteUnitario/2), If(ApartadoVta='M2' And Calidad='3',([Cantidad Pedido]*CosteUnitario/4

))



imoratal
Creator
Creator
Author

Sorry is this:

Sum(If(ApartadoVta='M2' And Calidad='2',[Cantidad Pedido]*CosteUnitario,0), If(ApartadoVta='M2' And Calidad='3',[Cantidad Pedido]*CosteUnitario,0))

Not applicable

missing closing bracket, use code and /code enclosed in square brackets [] to make formulas easier to read.

Not applicable

Sorry, it not the final closing bracket but you need to remove the closing bracket on the first line


if ( <condition>, <true>, <false>)
<false> can again be a full if, if( <condition>,<true>, if (<condition>,<true>,<false>))


Usually when you get a null value (standard display is "-") from formulas it is a broken syntax.

martin59
Specialist II
Specialist II

Why have you created a second post ?

You have the same answers here :

Utilizar función IF DUDA

imoratal
Creator
Creator
Author

Sorry Martin, I had not answers but the solution are the brackets. Thanks you