Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

kkarlste
New Contributor II

calculate dimension

Hi

have you any ideas this calculation dimension

how the script goes

if field1 = ('1','10) sum (field2 /0,85) otherwise take (field3)

if field4 = ('9225', '9153', '9161', '9122', '9104') field1 = ('1','10) sum (field2 / 0,9) otherwise take (field3)

10 Replies
thevingo
Contributor

Re: calculate dimension

If( field1 =1 or field1 =10,  sum (field2 /0.85), field3)

if ( match(field4 , '9225', '9153', '9161', '9122', '9104') and match(field1 , 1, 10),  sum (field2 / 0.9), field3)

kkarlste
New Contributor II

Re: calculate dimension

This is correct

=If( Tuottovarattavat = 'x' ,  sum (Kulut /0.85), Veroton)

but this is not

if ( match( [VBAPFactKEY], '009225', '009153', '009161', '009122', '009104') and (Tuottovarattavat = 'x' , sum (Kulut / 0.9), Veroton)

Highlighted
Partner
Partner

Re: calculate dimension

You forgot to close your sum. Try this:

if (match( [VBAPFactKEY], '009225', '009153', '009161', '009122', '009104') and (Tuottovarattavat = 'x' , sum (Kulut / 0.9)), Veroton)


AGB

Re: calculate dimension

kkarlste
New Contributor II

Re: calculate dimension

if ( match( [VBAPFactKEY], '009225', '009153', '009161', '009122', '009104') and (Tuottovarattavat = 'x' , (sum (Kulut / 0.9)), Veroton) 

if you this thig (sum

bold text not works

balabhaskarqlik
Honored Contributor

Re: calculate dimension

You were not closed the bracket of Tuottovarattavat='x' properly.'

Use below expression:

=if(Match([VBAPFactKEY],'009225','009153','009161','009122','009104') and (Tuottovarattavat = 'x'), Sum(Kulut/0.9),Veroton)

neelamsaroha157
Valued Contributor II

Re: calculate dimension

In order to use an aggregation function like Sum in calculated dimension, you'll need to use Aggr -

if ( match( [VBAPFactKEY], '009225', '009153', '009161', '009122', '009104') and (Tuottovarattavat = 'x' , Aggr(sum (Kulut / 0.9)), Veroton)

(Check on the number of paranthesis)

balabhaskarqlik
Honored Contributor

Re: calculate dimension

=If(Match(field1,'1','10'),Sum(field2/0.85),field3)

=if(Match(field4,'9225','9153','9161','9122','9104') and Match(field1,'1','10'),Sum(field2/0.9),field3)

kkarlste
New Contributor II

Re: calculate dimension

Correct answer