Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Highlighted
Contributor 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
Highlighted
Honored Contributor III

Re: Expression

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
Highlighted
Honored Contributor III

Re: Expression

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

Highlighted
New Contributor III

Re: Expression

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

Highlighted

Re: Expression

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

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Highlighted
New Contributor III

Re: Expression

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))

Highlighted
New Contributor III

Re: Expression

Please close this thread if your problem is solved

Highlighted
Honored Contributor III

Re: Expression

Already Closed ...

Highlighted
Contributor II

Re: Expression

already closed