Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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],
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;
Hi,
How about this one?
Sum(IF(Category = 'Start' and Issues= 'None' and Number1 = '20' ,1,0)) as [TestCount],
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])
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;
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
Didn't pay attention you said in the script. sunindia's answer should work in this case.