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

Sum of If with calculated value

I need your help to find a solution to the next issue. I am trying to write a nested if statement with calculated value condition:

Sum( If((Closed_Timestamp - Max({<Display_Name = {'Assignee'}>} Modified_Time)) > ((1/24/60) * TTF), 1, 0)

I tried different solutions to sum them, but anything seems to work when I saw Total row.

2 Replies

You can't nest aggregation functions like Max and Sum without using the Aggr function.

But perhaps you want to use the value of Max({<Display_Name = {'Assignee'}>} Modified_Time) that's calculated at the document level instead of in the context of a charts dimensions. In that case try

Sum( If((Closed_Timestamp - $(=Max({<Display_Name = {'Assignee'}>} Modified_Time)) ) > ((1/24/60) * TTF), 1, 0)

Other wise you'll have to use the aggr function and specify over which dimensions the max should be calculated.

Sum( If((Closed_Timestamp - aggr(Max({<Display_Name = {'Assignee'}>} Modified_Time),DimA,DimB,...DimX) ) > ((1/24/60) * TTF), 1, 0)

talk is cheap, supply exceeds demand
Contributor III
Contributor III

Thanks Gysbert

Your sample was the clue to find the correct code.