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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
upaliwije
Creator II
Creator II

Expression

Hi Friends

Can someone pls correct my following expression

sum(if(isnull(DESC) and Count(CLAIM_NO)>0,PREMIUM,AMOUNT))

14 Replies
sunny_talwar

The inner COUNT will need a aggregation function I think. Count(CLAIM_NO) over what dimension/s? Both PREMIUM and AMOUNT?

marcus_sommer

Try:

if(isnull(DESC) and Count(CLAIM_NO)>0, sum(PREMIUM), sum(AMOUNT))

- Marcus

upaliwije
Creator II
Creator II
Author

Yes Both Premium and Amount

upaliwije
Creator II
Creator II
Author

It is not working

My pivot table is as Follows

      

      

RISKPOLICY_PERIODPOLICY_NOCLAIM_NOPAID_AMOUNTPREMIUM
17-6819Aug-13 - Aug-14GN00111A0000119-013,805
17-6819Aug-14 - Aug-15GN00111A0000119CLGN001A1500002117,0000
17-6819Aug-14 - Aug-15GN00111A0000119CLGN001A1500002312,2000
17-6819Aug-14 - Aug-15GN00111A0000119CLGN001A150000364,0000
17-6819Aug-14 - Aug-15GN00111A0000119CLGN001A1500006313,2000
17-6819Aug-14 - Aug-15GN00111A0000119-013,105
17-6819Aug-15 - Aug-16GN00111A0000119-015,205

I want Premium shown in Bold not to appear since No claim Ns are recorded against them

marcus_sommer

Your check contains an AND which meant that both conditions must be true. You could leave your isnull(Desc) or replace it with something like len(trim(DESC))>0. Also if you have CLAIM_NO as column within the pivot you could reference to this column per column-name or column-no instead of calculating the count(CLAIM_NO) again.

- Marcus

upaliwije
Creator II
Creator II
Author

Can u please write the expression

marcus_sommer

Try:

assuming that CLAIM_NO is the first calculation-column:

if(len(trim(DESC))>0 and Column(1)>0, sum(PREMIUM), sum(AMOUNT))

if CLAIM_NO is a dimension:

if(len(trim(DESC))>0 and len(trim(CLAIM_NO))>0, sum(PREMIUM), sum(AMOUNT))

- Marcus

upaliwije
Creator II
Creator II
Author

thanks

it is still returning figures for premium for all rows

marcus_sommer

Try it with only a single-condition:

if CLAIM_NO is a dimension:

if(len(trim(DESC))>0 and len(trim(CLAIM_NO))>0, sum(PREMIUM), sum(AMOUNT))