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

Announcements
Note: You may notice some temporary visual or styling issues in the Community. Our vendor is actively investigating.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Does the IF evaluate both true and false part of the stetement?

I have this formula in a chart:

=if($(#=Only(FiscalQuarterNumber)) <= 2,
Sum({1< FiscalQuarterNumber = {$(#=Only(FiscalQuarterNumber)+2)}, FiscalYear = {$(#=Only(FiscalYear)-1)} >} Sales)
,
Sum({1< FiscalQuarterNumber = {$(#=Only(FiscalQuarterNumber)-2)}, FiscalYear = {$(#=Only(FiscalYear))} >} Sales)
)

If I select Q3 or Q4, the "false" part of the If check is executed and It returns me the Q1 or Q2.

If I select Q2, the "true" part is executed and it returns Q4

if I select Q1, the "true" part should also be executed and return Q3. However, nothing is returned. Even the expression being true, if I simply remove the "false" part and put something else, like 1111, it executes the "true" part with no error.

That makes me think that even if an expression is true, the false part is evaluated. If that correct? How to avoid that?

1 Reply
Not applicable
Author

Anyone?