Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
niranjana
Creator
Creator

MonthName in Qlik

Hi, 

I have a timestamp field in AM/PM format. I want month year format. So I used monthname(CREATIONDATE) as monthyear and I am getting the month -Years like "Apr 2023" .

BUt in If condition I must write if Monthyear>='Apr 2023',Monthyear. That is I want all monthyears on and after Apr 2023. BUt I am not getting. 

If (monthyear='Apr 2023', MOnthyear) is working but '>=' is not .

 

If I use Date(Date#(left(CREATIONDATE,10),'DD/MM/YYYY'),'MMM YYYY'), I am getting repeated like nOv 2020,

Nov 2020 , Dec 2023 etc...

Any help is appreciated.

Thanks

Niranjana

Labels (1)
2 Replies
PrashantSangle

try with Num()

Num(CREATIONDATE)>=num(Date#('Apr 2023','MMM YYYY'))

 

Regards,

Prashant Sangle

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Vegar
MVP
MVP

When using

monthname(CREATIONDATE) as Monthyear

the new field Monthyear becomes a dual, containing both the string value 'Apr 2023' and the numeric value equivalent to the date 2023-04-01. When comparing with Monthyear in the script or application you can utilise that like below.

If(Monthyear >= makedate(2023,4,1), ...

Or like @PrashantSangle 's example

If(Monthyear >= Date#('Apr 2023','MMM YYYY'), ...