Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for Data Integration and Data Analytics gurus. Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator III
Creator III

SUMIF


How would I SUM IF in the script? 

For example I want to SUM Category if type = 'Start', if issues = 'None' and if  Number1 = 20

Sum(IF(Category = 'Start' and(Issues= 'None') and(Number1 = '20'),1,0) as [TestCount],

Tags (3)
1 Solution

Accepted Solutions
Highlighted

Re: SUMIF

May be this:

Table:

LOAD Category,

          Issues,

          Number1,

          OtherFields

FROM source

Join(Table)

LOAD Count(Category) as [TestCount]

Resident Table

Where Category = 'Start' and Issues = 'None' and Number1 = 20;

View solution in original post

5 Replies
Highlighted
Specialist III
Specialist III

Re: SUMIF

Hi,

How about this one?

Sum(IF(Category = 'Start' and Issues= 'None'  and Number1 = '20' ,1,0)) as [TestCount],

Highlighted

Re: SUMIF

Hi, in script you are loading values row by row, to use Sum() in script you'll need to group your data using 'Group by', so there are more than one value to sum.

In your script maybe you don't need that, just mark each record as '1' or '0' and do the sum in the chart.

Script:

IF(Category = 'Start' and Issues= 'None' and Number1 = '20',1,0) as [TestCount],


Design (chart):

Sum([TestCount])

Highlighted

Re: SUMIF

May be this:

Table:

LOAD Category,

          Issues,

          Number1,

          OtherFields

FROM source

Join(Table)

LOAD Count(Category) as [TestCount]

Resident Table

Where Category = 'Start' and Issues = 'None' and Number1 = 20;

View solution in original post

Highlighted
Partner
Partner

Re: SUMIF

HI,

The below will give flag which can be be counted in the front end

IF(Category = 'Start' and Issues= 'None'  and Number1 = '20',1,0) as [TestCount]

Or below

Load

    KEyField,

    IF(Category = 'Start' and Issues= 'None'  and Number1 = '20',SUM(1)) as [TestCount]

Resident 'Your table'

Group by 'the field you want counting by'  //I.e. Product category.


Mark

Highlighted
Specialist III
Specialist III

Re: SUMIF

Didn't pay attention you said in the script. sunindia‌'s answer should work in this case.