Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
BARC’s The BI Survey 19 makes it official. BI users love Qlik. GET REPORT
thanhphongle
Contributor II

summing up an if statement with integrated aggregate function like sum and min

Hello Community,

this is my table

categoryuse_termpaymentmarkup
Notebook3102%
Notebook12101%

I created a variable called v_term_extension = 36

in this use case I would like to calculate:

sum(if( v_term_extension <= use_term,  use_term * payment * markup,

if( v_term_extension > use_term, (use_term * payment) +

(v_term_extension - sum (use_term)) * payment * (min(markup) = 1%)

)))

The result should be

categorycalculationresult
Notebook3 * 10 * 2%0,6
Notebook12 * 10 * 1%1,2
Notebook(36 - (12 + 3)) * 10 * 1 %2,1

is this possible to do this in QV?