Hello Community,
this is my table
category | use_term | payment | markup |
---|
Notebook | 3 | 10 | 2% |
Notebook | 12 | 10 | 1% |
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
category | calculation | result |
---|
Notebook | 3 * 10 * 2% | 0,6 |
Notebook | 12 * 10 * 1% | 1,2 |
Notebook | (36 - (12 + 3)) * 10 * 1 % | 2,1 |
is this possible to do this in QV?