Skip to main content
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

16 Replies
brijesh_fofadiy
Contributor III
Contributor III

Can you share your .qvf file ?

poojashribanger
Creator II
Creator II

Hi Nikhil,

you can use this date(today(),'YYYY')

satheshreddy
Creator III
Creator III

Hi Nikhil,

I have created Varaible As Date

am getting value in text box see.

Regards

Sathish

nikhilgarg
Specialist II
Specialist II
Author

Hey ,

Thanks Pooja. My mistake was i was using KPI oblject and checking value of variable in that. However when i take Text Object it works fine.

Thanks anyways

Ralf_Heukäufer
Partner - Creator III
Partner - Creator III

Hello Nikhil,

in the Variable it is this format you can see that if you use the variable in a Table for example.

Only when you use the variable in a KPI or perhaps another visualization you must change the representation format.

When you want to use it in more than one place create it one time and use it as a Master Item.

nikhilgarg
Specialist II
Specialist II
Author

Yup, it is working fine in text object and not in KPI object.

satheshreddy
Creator III
Creator III

Hi Nikil,

If you want to show in KPI, Please select Number formatting section

Measure expression option you will get Year

Regards

Sathish