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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
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 ?

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

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
MVP
MVP

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
MVP
MVP

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

apthansh
Creator
Creator
Author

Yup !!