Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to get the name of the month from the number in a text field

Hey everyone,

In a chart, I calculate some fields with a selection in a set analysis telling I want the sum of the data only when MyMonth = Month(Today())-1  (So the previous month).

In the title of the column of the chart, I'd like to display the name of the month  (Month(Today())-1 returns the number of the month)...

I would like to do something like Month(Today()-30), except that this won't work when we are on the 31st..

Any idea ?

Thank you for your help

1 Solution

Accepted Solutions
swuehl
MVP
MVP

=Month(AddMonths(today(),-1))

View solution in original post

4 Replies
MK_QSL
MVP
MVP

Use as below

=SubField('$(MonthNames)',';',Month(Today())-1)

swuehl
MVP
MVP

=Month(AddMonths(today(),-1))

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Use the text() function to force a text display (from the MonthNames script variable) or Date(Today(), 'MMM') for short names and Date(Today(), 'MMMM') for long names.

Replace Today() with AddMonths(Today(), -1) to get the previous month. Everything works both in expressions as well as in your load script.

Best,

Peter

JonnyPoole
Former Employee
Former Employee

one more. Date#() will read a month number as a month number using 'MM' . And then Date() with 'MMM' will  output in month name format

= date(date#(Month(Today())-1,'MM'),'MMM')

or

= date(date#(Month(Today())-1,'MM'),'MMMM')