Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
khaycock
Creator
Creator

Create field based on date

Is it possible to create a field based on a date? I wanted to create a field that shows deciphers whether data is pre-2019 or post-2019.

The date field I'm using has the format MMM DD, YYYY hh:mm:ss so would need to be split at Jan 01, 2019, 00:00:00 if possible?

 

Labels (1)
  • Date

16 Replies
khaycock
Creator
Creator
Author

My dashboard displays loads of security patches and their 'First Observed Date' field. I need to have a field that allows the user to drill using a field whether the patch was first observed before 31/Dec/2018 or after 01/Jan/2019 (new management processes went into access on Jan 1st so need to see the difference between all the data before 2019 and for all the data that comes after

dplr-rn
Partner - Master III
Partner - Master III

what happens when you move current date becomes 2020?
khaycock
Creator
Creator
Author

I was hoping we could force it to be anything >=2019. So anything that is equal to or larger than 2019 it would pick it up, therefore picking up 2019 and 2020?

dplr-rn
Partner - Master III
Partner - Master III

wont the current logic already pickup 2020 data and mark it as 'Post 2019'?
khaycock
Creator
Creator
Author

I wasn't sure because of the first half of the expression you gave me..

"if(Year(date(FirstDiscoveredAgain))= '2019',2019,"

 

Does that not make it equals to 2019 only?

dplr-rn
Partner - Master III
Partner - Master III

No
you are create a new column/dimension 2019_Flag  while checking year of your date. see below in green


if(Year(DATEFIELD)=2019 //if Year of your date field is equal to 2019
, 2019 // then 2019
, if(Year(DATEFIELD)<2019,  //if Year of your date field is less than 2019

           'Pre 2019','Post 2019') //then Pre 2019 else Post 2019
) as 2019_Flag

https://help.qlik.com/en-US/sense/February2019/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptCont...

dplr-rn
Partner - Master III
Partner - Master III

I would suggest you check out some qlik sense course in udemy
they are fairly inexpensive