Discussion board where members can get started with Qlik Sense.
I would like to check how can I convert a date field to an integer field?
For example, formatting date "20190131" AS integer "20190131"
The original date format is date-time, and I have formatted it with "Date" function to extract the date in format "YYYYMMDD".
Date(EffectiveDate, 'YYYYMMDD') as Date_Key
=> Convert Date to Text then Integer
Num#(TEXT(Date(EffectiveDate, 'YYYYMMDD'))) as Date_Key
I am not sure why you would wan to do this, but probably:
Num(Text(Date(EffectiveDate, 'YYYYMMDD'))) as Date_Key
View solution in original post
Hi, thanks for the reply. I tested your method but it didn't work.
The output returns blank instead.
NUM(TEXT(DATE(EFFECTIVE_DATE,'YYYYMMDD'))) AS DATE_KEY
I retested your method with num#() and it works! Thanks so much 🙂
You are absolutely correct - my bad.😀