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: 
thanhphongle
Creator II
Creator 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?

0 Replies