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: 
Not applicable

Expression formula(with if condition)

Dear All,

I'm looking for your kind help in following calculation

my table preview shown blow.

I want to calculate the BRO_ORC of 1% where BRO_COMM was calculated.As REF_NO,POL_NO, and CLA_CODE are equal it's difficult to build a formula in this connection. "2019-027" is a broker code where the relevant commission was calculated in the field BRO_COMM. "2022-001"is a Agent code where agent commission was calculated in the field of "AGE_COM" .  "7510" , "6297"  and many more ORC codes available where   BRO_ORC and AGE_ORC should be calculated accordingiy.

Your early attention would be much appreciated.

CRE_CODE REF_NO POL_NO CLA_CODE PREMUMBRO_COMMBRO_ORCAGE_COMGRO_COMATOT_COMDIFFTOTAL
2019-027BA0014D0028271BA00141B0002417MC435845241000524100
7510BA0014D0028271BA00141B0002417MC43584000038300
CRE_CODE REF_NO POL_NO CLA_CODE PREMUMBRO_COMMBRO_ORCAGE_COMGRO_COMATOT_COMDIFFTOTAL
2019-027BA0014D0028346BA00121A001111MC644837885000788500
6297BA0014D0028346BA00121A001111MC64483000058300
CRE_CODE REF_NO POL_NO CLA_CODE PREMUMBRO_COMMBRO_ORCAGE_COMGRO_COMATOT_COMDIFFTOTAL
2022-001BA0014D0028336BA00141H0000281MC159301390013900
6297BA0014D0028336BA00141H0000281MC159300003000
Total 1593 0 139 0 0 169 0 0

Regards,

Priyantha.

Labels (1)
1 Solution

Accepted Solutions
jyothish8807
Master II
Master II

Hi Priyantha,

try:

Exp1:

alt(sum({<Cat={'BR'},ORC={'ME'},BRO_COMM={'0'},AGE_COM={'0'},GRO_COM={'0'}>}COM_PRE),0)

Exp2:

Exp1/100

Regards

KC

Best Regards,
KC

View solution in original post

6 Replies
Not applicable
Author

Though I have not exactly understood your issue, but what you can do is use aggr(expression to calculate ORC's) function over REF_NO,POL_NO, and CLA_CODE fields.

Not applicable
Author

Dear Angad,

The Expression i have tried is below.

IF(CAT='BR',IF(ORC='ME',if('BRO_COMM'=0,if('AGE_COM'=0,if('GRO_COM'=0,(COM_PRE)/100,0)))))

But it is not working.

Regards,

Bandara.

jyothish8807
Master II
Master II

Hi Priyantha,

try:

Exp1:

alt(sum({<Cat={'BR'},ORC={'ME'},BRO_COMM={'0'},AGE_COM={'0'},GRO_COM={'0'}>}COM_PRE),0)

Exp2:

Exp1/100

Regards

KC

Best Regards,
KC
Not applicable
Author

Dear Kc,

Thanks for the early reply,

The formula you suggest was working, Calculation is being done against the broker codes and agent codes instead of calculating   against the ORC codes.

Anyway thanks again for the effort.

Regards,

Priyantha.

jyothish8807
Master II
Master II

Hi Priyantha,

Now wahat is not getting calculated.Can you please explain a bit about the issue?I just modified the expression you used.

Regards

KC

Best Regards,
KC
Not applicable
Author

Dear Kc

Please see the table i have posted carefully, Same POL_NO and REF_NO duplicated. Commission should be calculated to the Broker, Agent and Group where i labeled them as BRO_COMM,AGE_COM and GRO_COM. in addition to that over riding commission of 1% to be calculated to the marketing personnel where i labeled them as BRO_ORC). According to my database these are two records under the same REF_NO and POL_NO.

So I need to calculate the said over riding commission against the relevant ORC code. (7510,6297) see second row.   

Regards,

Priyantha.