Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
P_qlik
Partner - Contributor III
Partner - Contributor III

formula to have current month in a field in yyyymm format

Hi,

I have a numeric field like this for a date: 202101 , 202102, 202103, 202104, which formula can I use to reveal the current month?

Thank you

1 Solution

Accepted Solutions
duchezbr
Contributor III
Contributor III

Try: 

Date(Date#([Date Field], 'YYYYMM'), 'MMM')

Using 'MMM' in the Date function will return Jan, Feb, Mar, Apr for the dates listed in your example. To return just the number (e.g., 01, 02, etc.) change 'MMM' to 'MM'

To define the current month just wrap the above expression in Max()

Max(Date(Date#([Date Field], 'YYYYMM'), 'MMM'))

View solution in original post

1 Reply
duchezbr
Contributor III
Contributor III

Try: 

Date(Date#([Date Field], 'YYYYMM'), 'MMM')

Using 'MMM' in the Date function will return Jan, Feb, Mar, Apr for the dates listed in your example. To return just the number (e.g., 01, 02, etc.) change 'MMM' to 'MM'

To define the current month just wrap the above expression in Max()

Max(Date(Date#([Date Field], 'YYYYMM'), 'MMM'))