Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld 2023, a live, in-person thrill ride. April 17 - 20, 2023, in Las Vegas! REGISTER TODAY
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'))