Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Only at Qlik Connect! Guest keynote Jesse Cole shares his secrets for daring to be different. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

sumif in scripts

Hi, can i use sumif in the scripts? I used the following in the scripts but i got an error in expression..

sum(if((QuarterID - 12),Revenue) as NewRevenue

Thanks!

1 Solution

Accepted Solutions
anbu1984
Master III
Master III

Bracket is missing in your statement

sum(if((QuarterID - 12),Revenue)) as NewRevenue

View solution in original post

4 Replies
Anonymous
Not applicable
Author

something like that

sum(if(QuarterID - 12 = 0,0,Revenue)) as NewRevenue

maxgro
MVP
MVP

with this test data

a:

load * inline [

Year,Quarter,Revenue

2010,1,100

2010,2,100

2010,3,100

2010,4,100

2011,1,100

2011,2,100

2011,3,100

2011,4,100

];

you can have this script

load

  *,

  if(Quarter=12,Revenue,0) as NewRevenue

Resident a;

or this

load

  Year,

  sum(if(Quarter=12,Revenue,0)) as NewRevenue

Resident a

  group by Year;

anbu1984
Master III
Master III

Bracket is missing in your statement

sum(if((QuarterID - 12),Revenue)) as NewRevenue

Anonymous
Not applicable
Author

Thanks!