Skip to main content
Announcements
See why Qlik was named a Leader in the 2024 Gartner® Magic Quadrant™ for Data Integration Tools for the ninth year in a row: Get the report
cancel
Showing results for 
Search instead for 
Did you mean: 
apthansh
Creator
Creator

Nested if in load script error

Load,

[ ID Key],

CPKey,

Sum(IF(sum(if(CYQ='Q'&ceil(Month(Today())/3)&'_'& year(Today()),Comm)) <=0,

   sum(if(CPYQ='Q'&ceil(Month(Today())/3)&'_'& year(Today()),CommPlan)),

    sum(if(CYQ='Q'&ceil(Month(Today())/3)&'_'& year(Today()),Comm)))) as SF

   

Resident SF

Group by [ID Key],

                 CPKey;

Drop Table SF;

I a using the above script and I am getting error saying cannot do nested aggregation is not allowed ? Cant I do it or I am doing something wrong here ?

1 Solution

Accepted Solutions
sunny_talwar

May be this

LOAD [ ID Key],

CPKey,

If(Sum(if(CYQ='Q'&ceil(Month(Today())/3)&'_'& year(Today()),Comm)) <= 0,

  Sum(if(CPYQ='Q'&ceil(Month(Today())/3)&'_'& year(Today()), CommPlan)),

  Sum(if(CYQ='Q'&ceil(Month(Today())/3)&'_'& year(Today()),Comm))) as SF

Resident SF

Group by [ID Key], CPKey;

DROP Table SF;

View solution in original post

4 Replies
sunny_talwar

May be this

LOAD [ ID Key],

CPKey,

If(Sum(if(CYQ='Q'&ceil(Month(Today())/3)&'_'& year(Today()),Comm)) <= 0,

  Sum(if(CPYQ='Q'&ceil(Month(Today())/3)&'_'& year(Today()), CommPlan)),

  Sum(if(CYQ='Q'&ceil(Month(Today())/3)&'_'& year(Today()),Comm))) as SF

Resident SF

Group by [ID Key], CPKey;

DROP Table SF;

apthansh
Creator
Creator
Author

How Silly..I just missed the if !!

Thank you very much.You are a rockstar !!

sunny_talwar

You didn't miss an if... but you had an extra Sum()

apthansh
Creator
Creator
Author

Yup !!