Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Become an analytics expert with Qlik's new 15 week course: Applied Data Analytics using Qlik Sense. READ MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How can i create expression with if command?

Hi,

Please help me to create the following expression in my project, even expression shows the status OK, it does not woks.

SUM(IF('BRO_COMM'=0 AND 'AGE_COM'=0 AND 'GRO_COM'=0,(COM_PRE*ME_COM+SR*ME_RS+TC*ME_TC)/100))

regard,

Priyantha.

1 Solution

Accepted Solutions
chinnakatikisg
Specialist
Specialist

Try this:

IF((BRO_COMM=0 AND AGE_COM=0 AND GRO_COM=0),((COM_PRE*ME_COM)+(SR*ME_RS)+(TC*ME_TC))/100,0)


or  you may try below


if (BRO_COMM=0,if(AGE_COM=0,if(GRO_COM=0,((COM_PRE*ME_COM)+(SR*ME_RS)+(TC*ME_TC))/100,0)))


Mark the Question as answered, if any one's answer is works for you.


Regards,

Chinna

View solution in original post

11 Replies
jsingh71
Partner
Partner

Try this:

(IF('BRO_COMM'=0 AND 'AGE_COM'=0 AND 'GRO_COM'=0,((COM_PRE*ME_COM)+(SR*ME_RS)+(TC*ME_TC))/100))

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this

=SUM({<BRO_COMM={'0'}, AGE_COM={'0'}, GRO_COM={'0'}>} ((COM_PRE*ME_COM)+(SR*ME_RS)+(TC*ME_TC)))/100

Hope this helps you.

Regards,

Jagan.

Not applicable
Author

Dear Priyantaha,

Try this...

if('BRO_COMM'=0 AND 'AGE_COM'=0 AND 'GRO_COM'=0,sum((COM_PRE*ME_COM+SR*ME_RS+TC*ME_TC))/100)

Thanks & Regards

Prince Anand

Not applicable
Author

Dear Jagan,

Thaks for the reply.

the formula you sent is worked, but ÏF" condition dose not works. it means, even above one of three expressions have values grater than "0" , formula result shows value (in this case result should be zero)

Regards,

Priyantha.

jyothish8807
Master II
Master II

Hi Priyanth,

Try using ALT function in the above expression suggested by Jagan.

=Alt(SUM({<BRO_COMM={'0'}, AGE_COM={'0'}, GRO_COM={'0'}>} ((COM_PRE*ME_COM)+(SR*ME_RS)+(TC*ME_TC)))/100,0)

Regards

KC

Best Regards,
KC
Not applicable
Author

Try below:

SUM(IF('BRO_COMM'='0' AND 'AGE_COM'='0' AND 'GRO_COM'='0',(((COM_PRE*ME_COM)+(SR*ME_RS)+(TC*ME_TC))/100),0))

I assume the 'BRO_COMM', 'AGE_COM' are not fields but dynamic values coming from a variable.

Thanks,

Singh

Not applicable
Author

Dear Kc,

Thaks for the reply.

the formula you sent is worked, but ÏF" condition dose not works. it means, even above one of three expressions have values grater than "0" , formula result shows value (in this case result should be zero)

Regards,

Priyantha.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Can you attach some sample data and explain with an example and expected output?

Regards,

Jagan.

Not applicable
Author

BCOD

CRE_CODE REF_NO PREMUMBRO_COMMBRO_ORCAGE_COMAGE_ORCGRO_COMGRO_ORCME_COMTOT_COMDIFF
BA002019-027BA0014D00282714358452413830000052410
BA0014D00282761106051347999400000134790
BA0014D00283466448378855830000078850
Total 21867226604195900000266040
C0001084BA0014D00283684885900426191500042610
Total 4885900426191500042610
C0001731BA0014D00282262497400221747100022170
BA0014D00283092156000200041600020000
BA0014D002842570400010001460006480
BA0014D00284641593200221933600021340
BA0014D00284656765009531410009230
BA0014D00284802562500360653600023250
Total 10189600119962047000102470
C0004862BA0014D002820945500039208475005392050050
Total 45500039208475005392050050
C0004866BA0014D002824913660012202581503122015030
BA0014D002828317953015703371975157019750
BA0014D0028328600105601166605606600

Dear Jagan,

Thanks for the quick reply.

See the above table. i want to get the output in the column 'ME_COM'. If   'BRO_COMM' , 'AGE_COM' and 'GRO_COM' columns available zero value then only the 'ME_COM' calculated('PREMIUM'*5%). in other word, if some value available in one of above three columns(grater than zero) the 'ME_COM' result should be zero.

Regards,

Priyantha