Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

sum function not working on nested if statements

hello all,

i have a nested if statement that works properly. i need to sum the result so that i can get the sum to show when i swich to pivot table view.

if

((AddMonths((date(today())),-v_mlai)>date(max({$<m=,q=,y=,day=>}[sale date])))
,sum({$<m=,q=,y=,day=>}[[items in inventory])

,if(IsNull([sale date])
,if((AddMonths((date(today())),-v_mlai)>date(Max({$<m=,q=,y=,day=>}[inventory date])))
,sum({$<m=,q=,y=,day=>}[items in inventory])
,0)
,0)
)

i have tried puting the entire statement in a sum() function but that dosnt work (i get ' -'  value in all the cells). i also tried reconstracting the statement in severl different ways removing the set analysis and removing the sum() statements that are in the if() statments but i cant get it to wrok.

can someone pls tell me why dosnt puting the entire statement in a sum() function work?

also if you have any sugastions on how to reconstract the statment so that i get to sum to show on a pivot table, they will be greatly appreciated.

thanks in advance,

jonathan

1 Solution

Accepted Solutions
anbu1984
Master III
Master III

You cannot directly use one aggregate function inside another aggregate function

You can try like Sum(Aggr(Your_expr,Dim1,Dim2..))

View solution in original post

3 Replies
anbu1984
Master III
Master III

You cannot directly use one aggregate function inside another aggregate function

You can try like Sum(Aggr(Your_expr,Dim1,Dim2..))

MK_QSL
MVP
MVP

provide sample data please

Not applicable
Author

thanks for the help. i removed both the sum() and max() functions  and put the entire statement in a sum() function (moving the set analysis to the outer sum function only) and it works.

thanks again