Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
nikhilgarg
Specialist II
Specialist II

Error in expression

Hey,

In qliksense, i am trying to create a variable by calculate Year of posting date

My Date format is : MM/DD/YYYY hh:mm:ss TT

I am trying like:

vCurYear = Year(Date(Today(1), 'MM/DD/YYYY'))

Let say date is 10/25/2017, above expression giving me 2.02K in qliksense.

I want to store value i.e. 2017 in variable i.e. vCurYear.

How to solve this?

Thanks,

Nikhil Garg

1 Solution

Accepted Solutions
satheshreddy
Creator III
Creator III

Hi Nikhil,

I have created Varaible As Date

am getting value in text box see.

Regards

Sathish

View solution in original post

16 Replies
arulsettu
Master III
Master III

try this

vCurYear = max(Year(date))

nikhilgarg
Specialist II
Specialist II
Author

Nope, it is working in the same manner

arulsettu
Master III
Master III

can you share sample data

Anonymous
Not applicable

try

vCurYear = Year(getdate())

satheshreddy
Creator III
Creator III

Hi Nikil,

you have using the below EXP:

vCurYear = Year(Date(Today(1), 'MM/DD/YYYY'))

Please use like below

vCurYear = Year(Date(Today(), 'MM/DD/YYYY'))

Regards

Sathish

Ralf_Heukäufer
Partner - Creator III
Partner - Creator III

Try to change Number Formating:

Or you must change it to a String.

To Format it without the point.

nikhilgarg
Specialist II
Specialist II
Author

Hey Satti,

I tried your way but again same result. Pls find attached snapshot.

Also, i want to save the result in the variable.

nikhilgarg
Specialist II
Specialist II
Author

Hey Ralf,

I need to save the result in the variable. I tried same number format at variable level, but does not worked

nikhilgarg
Specialist II
Specialist II
Author

Hey Mikel,

Nope, it does not worked.