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

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Creating a max year and min year variables

Hi All,

I want to create 2 fields ie max year and minimum year from the loaded data i.e Year. I have the data from 2000 to 2012. I should be able to select the min and the max years from them. Can anyone suggest a way to do that?

Thanks & regards

Anirban

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

To select the maximum and minimum value from datefield you can use as

vMaxYear=Max(Year(DateFiled));

vMinYear=Min(Year(DateFiled));

But if you want to select the trend year dynamically  then use the input box to assign the values to the variables and use that variables to your expression

View solution in original post

4 Replies
tresesco
MVP
MVP

It's not very clear to me what you want. If you want a variable to display the max Year use, Max(Year), if you want a maximum date from the selected year, use Max(Date). Similarly, use Min() for minimums.

Not applicable
Author

Many thanks for the reply tresesco.

let me rephrase my question - i have a field called year. I want to create 2 more fields say Year1 and Year2. I need this to study the trend between two given period. For eg - if want to see the trend between 2009 and 2011. i should be able to select 2009 as Year 1 and 2011 as Year 2. As of now i am not able to make such selections.

Hope this clarifies.

Thanks - Anirban

Not applicable
Author

Hi,

To select the maximum and minimum value from datefield you can use as

vMaxYear=Max(Year(DateFiled));

vMinYear=Min(Year(DateFiled));

But if you want to select the trend year dynamically  then use the input box to assign the values to the variables and use that variables to your expression

tresesco
MVP
MVP

Dear Anirban,

If you are trying to select a range, you might want to have a look here     . The attachment would be helpful i believe. You might want to use a concept of FROM-TO selection for date or year.