Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Highlighted
robert2012
New Contributor III

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

Thank you for your help!

Tags (1)
1 Solution

Accepted Solutions
Highlighted
er_mohit
Honored Contributor II

Re: sum(if) for a specific selection

try this

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

View solution in original post

10 Replies
Highlighted
Not applicable

Re: sum(if) for a specific selection

Hi,

Try this

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

Highlighted
er_mohit
Honored Contributor II

Re: sum(if) for a specific selection

try this

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

View solution in original post

Highlighted
Not applicable

Re: sum(if) for a specific selection

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

Highlighted
Not applicable

Re: sum(if) for a specific selection

Hi,

Try this

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

Highlighted
sivarajs
Valued Contributor II

Re: sum(if) for a specific selection

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

Highlighted
robert2012
New Contributor III

Re: sum(if) for a specific selection

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

Highlighted
robert2012
New Contributor III

Re: sum(if) for a specific selection

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

Highlighted
sivarajs
Valued Contributor II

Re: sum(if) for a specific selection

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

Load * sum(x)as tmp

from x.qvd group by y;

Highlighted
robert2012
New Contributor III

Re: sum(if) for a specific selection

Thank you very much!! It works...