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: 
Not applicable

How make filter sum of two attributes?

Hi,

For instance, I have table shown like below:

Month     1Order  2Order

Jan           1           0

Feb           2           0

March       1            1

Aug           2            1

I want filter three different filter for three expression.

expression 1:  [1Order] + [2Order] = 1

expression 2:  [1Order] + [2Order] => 2  and  [1Order] + [2Order] <=4

expression 3:  [1Order] + [2Order] > 4

I tried in the expression for expression 1 Sum({$< [1Order] + [2Order] ={'1'}>} ([1Order] + [2Order]))  but it doesn't not work.

I have solution in the data model  [1Order] + [2Order] as 3Order

then expression would be Sum({$< [3Order] ={'1'}>} [3Order])

My aim want to do this in set expression.

Best,

Robert

1 Solution

Accepted Solutions
anbu1984
Master III
Master III

Sum(If( [1Order] + [2Order] =1, ([1Order] + [2Order]))

View solution in original post

8 Replies
MK_QSL
MVP
MVP

What is your dimension ?

Not applicable
Author

Hi,

My original data like this below and my dimension is month.  

Month              phone    1Order  2Order

Jan-2013           956              1           0

Feb -2013          456             2            0

March-2014       989             1            1

Aug -2014         765              2            1

Indeed, i have data since march-2013 till today.

Best,

Robert

anbu1984
Master III
Master III

Sum(If( [1Order] + [2Order] =1, ([1Order] + [2Order]))

Not applicable
Author

Thanks ...

Not applicable
Author

My solution would be:

Sum(If( [1Order] + [2Order] =1, ([1Order] + [2Order]))


Sum(If( [1Order] + [2Order] =>2 and [1Order] + [2Order] <=4, ([1Order] + [2Order]))


Sum(If( [1Order] + [2Order] >4, ([1Order] + [2Order]))


MK_QSL
MVP
MVP

Your question was, you want to get this in SET EXPRESSION !

Not applicable
Author

Yes. My aim want to be do in the expression not in the data model.

MK_QSL
MVP
MVP

My understanding was you want as Set Analysis and not using IF... But any how, you got your required answer...

Cheers !