Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
John3
Contributor III
Contributor III

Qlik Sense Syntax

How do I create the syntax for:

An If statement that checks date for current year, like so:

If (year selected by filter = current year)

then --- Sum () statement 1,

else --- Sum() statement 2)

I don´t know how to write the condition part of this IF statement in parentheses, to check if selected year is current year.

Labels (1)
6 Replies
JuanGerardo
Partner - Specialist
Partner - Specialist

Try:

If(Max(YearField) = Year(Today()), Sum(condition1), Sum(condition2))

JG

NitinK7
Specialist
Specialist

try below

If(getfieldselection(year) = Year(Today()), Sum(condition1), Sum(condition2))

John3
Contributor III
Contributor III
Author

Thanks Juan.  I´m trying it now. 

John3
Contributor III
Contributor III
Author

Thanks Nitink7.

For the new QlikSense vocabulary with getfieldselection. I´ll try it out. 

John3
Contributor III
Contributor III
Author

Thanks Juan. It works!

John3
Contributor III
Contributor III
Author

Thanks Nitink7. I just tried it and it worked.