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: 
retko1985
Creator II
Creator II

max(Year)-1 returns somethins wrong date

Hello,

I have a listbox with years (including 2018 from calendar database) and a variable vPriorYear, which has assigned    =max(Year)-1.

Now I created a text box with this - =$(vPriorYear) or I also tried this -   =vPriorYear .

Now I click through the years ans sometimes ( cant predict when) instead of the last year of the clicked year itdisplays 2017. So for example I click 2014 and text box displays 2017. It only reverse to 2017 year, not other different year.

I this behaviour familiar to someone? What can I do? Is here some other expression to refer to previous year of the selected that I can try?

Thank you.

1 Solution

Accepted Solutions
retko1985
Creator II
Creator II
Author

I figured it out. There was a problem with alternate states. This works fine -  =$(=max({<Year=$::Year>}Year-1))

Thank you.

View solution in original post

3 Replies
tresesco
MVP
MVP

Could you post a sample representative qvw?

chanin7893
Partner - Contributor III
Partner - Contributor III

You can try this out in the expression column

Sum({<Year= {$(= max(Year-1))}>}[Field Name])

retko1985
Creator II
Creator II
Author

I figured it out. There was a problem with alternate states. This works fine -  =$(=max({<Year=$::Year>}Year-1))

Thank you.