Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

problem with conditional sum

Hello, I have a problem with a conditional sum.

I have the following situation. I have a straight table with one dimension called region. and then I have the following 3 expressions:

1) if

(year=2010 , sum(A)+sum(b))

2) if(year=2009 , sum(A)+sum(b))

3) column(1)/column(2)

my problem is the current one. If the user doenst select anything both 1 and 2 are not calculated. then if user selects year 2010 only 1 is getting caclulated and user selects 2009 as a year only the 2 is getting populated. what I want is that both of them are getting calculated on the same time so 3 can work.

any ideas? thank you in advance!



1 Solution

Accepted Solutions
Not applicable
Author

Hi,

Try use set analysis:


For expression 1:
Sum({$<Year = {2010}>} A + B)
For Expression 2:
Sum({$<Year = {2009}>} A + B)


Regards

View solution in original post

3 Replies
Not applicable
Author

Hi,

Try use set analysis:


For expression 1:
Sum({$<Year = {2010}>} A + B)
For Expression 2:
Sum({$<Year = {2009}>} A + B)


Regards

syed_muzammil
Partner - Creator II
Partner - Creator II

Hi,

Tr using set Analysis.

1.Sum({<Year={2010}>} A)+Sum({<Year={2010}>} B) or Sum({<Year={2010}>} A+B) (Depending on your Table structure)

2.Sum({<Year={2009}>} A)+Sum({<Year={2009}>} B) or Sum({<Year={2010}>} A+B)

Regards,

Syed Muzammil.

Not applicable
Author

thanks guys! it works!