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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
bharatkishore
Creator III
Creator III

Date help

Hi All,

I have a date field in a table with 'YYYY-MM' format and i have years from 1950-01 to 2019-01.

Now i need to make all the years which are <=2011-01 to 2011-01.

I have give condition like this 

if(date(Install_Date<='2011-01'),'2011-01',Install_Date) as Install_Date_Dummy, but in the list box i am getting as below:

T.PNG

But for 2011-01 i am getting left side in list box.. can you please tell me how to get all in one format.

Thanks,

Bharat

 

Labels (1)
1 Solution

Accepted Solutions
tresB
Champion III
Champion III

It's not good practice to use text comparison here. Having said that, for a quick fix, you could try like:

if(date(Install_Date<='2011-01'),Date(Date#('2011-01', 'YYYY-MM'),'YYYY-MM'),Install_Date) as Install_Date_Dummy

View solution in original post

2 Replies
tresB
Champion III
Champion III

It's not good practice to use text comparison here. Having said that, for a quick fix, you could try like:

if(date(Install_Date<='2011-01'),Date(Date#('2011-01', 'YYYY-MM'),'YYYY-MM'),Install_Date) as Install_Date_Dummy

bharatkishore
Creator III
Creator III
Author

I tried this as well and this also worked:

date#(if(date(Install_date<='2011-01'),'2011-01',Install_Date))