Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
upaliwije
Creator II
Creator II

Expression

Hi Friends

In my QV document I have a straight table where the Expression for Calculated Premium field does not show results as shown below

Screenshot_1.png

I have attached my document. Pls advise me to correct my error

1 Solution

Accepted Solutions
prma7799
Master III
Master III

Please  try like

=if (Aggr(IF(MaxString({<[BCOD]=P([BCOD])>}[BCOD])=[BCOD],[BCOD]),[BCOD])=BCOD,

(num(if (Aggr(IF(MaxString({<[BCOD]=P([BCOD])>}[BCOD])=[BCOD],[BCOD]),[BCOD])=BCOD, sum(PREMIUM)),'##,##0')

-

if (Aggr(sum({$<CC_CODE={'CC*'}>}PREMIUM),BCOD)>0,Aggr(sum({$<CC_CODE={'CC*'}>}PREMIUM),BCOD),0)

),sum(PREMIUM))

View solution in original post

7 Replies
prma7799
Master III
Master III

Please  try like

=if (Aggr(IF(MaxString({<[BCOD]=P([BCOD])>}[BCOD])=[BCOD],[BCOD]),[BCOD])=BCOD,

(num(if (Aggr(IF(MaxString({<[BCOD]=P([BCOD])>}[BCOD])=[BCOD],[BCOD]),[BCOD])=BCOD, sum(PREMIUM)),'##,##0')

-

if (Aggr(sum({$<CC_CODE={'CC*'}>}PREMIUM),BCOD)>0,Aggr(sum({$<CC_CODE={'CC*'}>}PREMIUM),BCOD),0)

),sum(PREMIUM))

Anonymous
Not applicable

Can you tell us what is it that you want to be displayed in the last column?

Anil_Babu_Samineni

As always, try to ignore direct field names. And use Simple aggregation Sum() for your data point.

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable

This seems to be the correct answer you are looking for...

if (Aggr(IF(MaxString({<[BCOD]=P([BCOD])>}[BCOD])=[BCOD],[BCOD]),[BCOD])=BCOD,
(
num(if (Aggr(IF(MaxString({<[BCOD]=P([BCOD])>}[BCOD])=[BCOD],[BCOD]),[BCOD])=BCOD, sum(PREMIUM)),'##,##0')
-
if (Aggr(sum({$<CC_CODE={'CC*'}>}sum(PREMIUM)),BCOD)>0,Aggr(sum({$<CC_CODE={'CC*'}>}sum(PREMIUM)),BCOD),0)
),
sum(PREMIUM))

Anonymous
Not applicable

Please close this thread if your problem is solved

prma7799
Master III
Master III

Already Closed ...

upaliwije
Creator II
Creator II
Author

already closed