Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
kkarlste
Creator
Creator

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

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
Creator
Creator
Author

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)

sewialwork
Partner - Contributor III
Partner - Contributor III

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

sunny_talwar

kkarlste
Creator
Creator
Author

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

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
Specialist II
Specialist II

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

=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
Creator
Creator
Author

Correct answer