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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum(If()) in Script

Hi,

     I have the following expression in the scripting editor

   

     Load Rig,

     'Plans' as P,

     Sum(If(Planname<>'',1,0))

    

     Resident v

     Group by Rig

    

     While Loading the Script I am getting an Error 'Error in Expression'.

      I have some table as v.

      Please correct me as to where am I going wrong?

  Regards

Navin Gorapalli

2 Replies
Not applicable
Author

Navin,

Your script should be

Load Rig,

     'Plans' as P,

     Sum(If(Planname<>'',1,0)) as Col

     Resident v

     Group by Rig, Plans

Regards

Ravi Kumar

pat_agen
Specialist
Specialist

hi,

you want a table with the number of Plans per Rig? and in your table v you have a filed called PlanName and if PlanName is filled in (that is different to null) ypu want to count each record as being a plan. Is this correct?

then try this

load Rig,

'Plans' as P,

count(Planname)

resident v

where len(Planname)>0

group by Rig;

hope this helps.