Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
thnkgreen
Contributor

SUM IF with a date in LOAD Script

Hello everyone.  I am having trouble getting the syntax right in my load script.  Here is what I have:

SUM(IF(SO_AD_SEG_MET.w_prd_dt='2016-04-01',SO_AD_SEG_MET.metric_value)) AS test

What is wrong with this syntax, please?

1 Solution

Accepted Solutions
mark6505
Valued Contributor III

Re: SUM IF with a date in LOAD Script

Hi,

what is the error you are getting.

As you are doing aggregate you probably need to add a group by after your load or resident.

Mark

7 Replies
vishsaggi
Esteemed Contributor III

Re: SUM IF with a date in LOAD Script

Are you writing this aggregation as an SQL statement. Did you use Group By clause in the end ?

LOAD

*;

SQL SELECT

col1,

col2,

SUM(IF(SO_AD_SEG_MET.w_prd_dt='2016-04-01',SO_AD_SEG_MET.metric_value)) AS test

FROM SO_AD_SEG_MET

GROUP BY Col1, Col2......


Something like this. Can you post the whole script statement you are using and the error you are getting?


V.


mark6505
Valued Contributor III

Re: SUM IF with a date in LOAD Script

Hi,

what is the error you are getting.

As you are doing aggregate you probably need to add a group by after your load or resident.

Mark

thnkgreen
Contributor

Re: SUM IF with a date in LOAD Script

I am trying to accomplish this sum-if  in the load statement.  Is that not possible?

Re: SUM IF with a date in LOAD Script

Syntax doesn't seem to be wrong, what is the error you are getting? Have you made sure to add the Group by statement as mentioned by vishsaggi‌ above?

Re: SUM IF with a date in LOAD Script

It is possible, what is the script for the whole table? and what error are you getting?

hrlinder
Honored Contributor

Re: SUM IF with a date in LOAD Script

what is your result?

check the dateformat of SO_AD_SEG_MET.w_prd_dt

thnkgreen
Contributor

Re: SUM IF with a date in LOAD Script

I did need to use aggregation (a group by).  Thank you

Community Browser