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

Help with a formula

I need, if it possible to write a formula, with this procedure,  I have a field called YEAR, so if this field is filtered (like I choose only data from 2015) then the formula must return year selected minus one (then 2014).   But if YEAR is not filtered then must return CURRENT year minus one. 

Is this possible? can you help me

Thanks in advanced

5 Replies
sunny_talwar

May be this:

Max(YearField) - 1

Replace YearField with your actual Year Field Name here

danansell42
Creator III
Creator III

Hi Claus

If i understand correctly this might be what you're looking for:

if(GetSelectedCount(Year)=1,sum({<Year={'$(=GetFieldSelections(Year)-1)'}>}UNITS),sum({<Year={'$(=max(Year)-1)'}>} NITS))

Thanks

Dan

danansell42
Creator III
Creator III

Sunny's idea works better, mine was to complicated

so full formula would have been:

sum({<Year= {'$(=max(Year)-1)'}>}UNITS)

Not applicable
Author

both answers work fine, thanks

danansell42
Creator III
Creator III

Hi Claus

Please mark an answer as correct so its helpful for other users in the community.

Thanks

Dan