Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
Mark_Little
Luminary
Luminary

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

View solution in original post

7 Replies
vishsaggi
Champion III
Champion III

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.


Mark_Little
Luminary
Luminary

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

Anonymous
Not applicable
Author

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

sunny_talwar

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?

sunny_talwar

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

Anonymous
Not applicable
Author

what is your result?

check the dateformat of SO_AD_SEG_MET.w_prd_dt

Anonymous
Not applicable
Author

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