Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Difference b/w Set Analysis & If

Hi,

The functioning of these two expressions gives different result..Can Anyone help me to figure out?

sum( {$<Time={"<=$(TimeCount)"}>} [# of Checks] )

sum(if (Time <= $(TimeCount),[# of Checks]))



5 Replies
Not applicable
Author

Hi Blessy,

Both these expressions should return the same value. I am not sure why it gives different values.

I doubt, this might be due to the data type of the field 'Time'. Can you update the variable definition by including the data type of the field 'Time' and check if it works.\

Not applicable
Author

Try this Actually set functions checks conditions first then makes aggregation sum( {$} [# of Checks] ) so the equivalent if statement for above expression would be if (Time
Not applicable
Author

Try this Actually set functions checks conditions first then makes aggregation sum( {$} [# of Checks] ) so the equivalent if statement for above expression would be if (Time
llauses243
Creator III
Creator III

sum(if ... func in all version

sum($ ... Func in V9 no func in other version, return null

johnw
Champion III
Champion III

The original expressions do have different meanings. The set analysis expression OVERRIDES the selection in Time. The if() respects selections in Time. So if any Times are selected, that could cause you to get different results. To make the expressions return exactly the same value in all cases would be this, I believe:

sum( {<Time*={"<=$(TimeCount)"}>} [# of Checks] )
sum(if(Time <=$(TimeCount), [# of Checks]))