10 Replies Latest reply: Feb 27, 2013 4:36 AM by Robert Ebner

# sum(if) for a specific selection

Hi all,

I want to use the sum(if)-function for a specific selection (all values between 3999 and 5000). My idea is like this, but it doesen't work:

sum(if(booking> 3999 and booking< 5000, cost)) as cost_special

• ###### Re: sum(if) for a specific selection

Hi,

Try this

IF(SUM(booking)>3999 AND SUM(booking)<5000,cost) as cost_special

• ###### Re: sum(if) for a specific selection

Hi,

Try this

IF(SUM(booking)>3999 AND SUM(booking)<5000,SUM(cost)) as cost_special

• ###### Re: sum(if) for a specific selection

try this

sum(rangeonly(if(booking>3999 and booking<5000,cost)as cost_special

• ###### Re: sum(if) for a specific selection

Thank you very much!! It works...

• ###### Re: sum(if) for a specific selection

sum( total if(booking> 3999 and booking< 5000, cost)) as cost_special

• ###### Re: sum(if) for a specific selection

Thank you, but it doesn't work. QV says that there is a skript mistake.

• ###### Re: sum(if) for a specific selection

sum({<booking={">3999<5000"}>}cost)

• ###### Re: sum(if) for a specific selection

Thank you, but it doesn't work. QV says that there is a skript mistake.

• ###### Re: sum(if) for a specific selection

Set analysis wont work with script.Did you use Group by clause in your table

from x.qvd group by y;

• ###### Re: sum(if) for a specific selection

Thank you!

I use "group by", but if I comment it out it still didn't work.

I will take the solution provided by er.mohit.

Thank you very much for your help!