Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to get previous month name from selection box?

Hello, I need previous month name when I select any month from Month List Box.
I don't need previous month from Today date. Lets say if I select 'May' from list box, then i must get 'April'.
Anyone? Thanks.

1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

Try this

=Date(MonthStart(Max(DateField), -1), 'MMMM')

View solution in original post

6 Replies
Not applicable
Author

Hi

try,

=Only(Month(addmonths([DATE FIELD HERE],-1)))

it depends where you're using it. you can try this in a text box^^

amitarusi
Contributor III
Contributor III

in the script try this:

load

datefield,

Month(makedate(year(datefield),(num(month([date]))-1),day(datefield))) as prevmonth,

month(datefield) as month,

...

...

from tablename;

In the UI when you will select month the field "prevmonth" will represent the previous month,

Not applicable
Author

Alexis, it partially solves the problem. But it returns me 3-lettered month name. How can I get full month name here? Thanks for the help though

CELAMBARASAN
Partner - Champion
Partner - Champion

Try this

=Date(MonthStart(Max(DateField), -1), 'MMMM')

Not applicable
Author

Hi,

on your edit script

find this line

SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';

then change it to

Set MonthNames='January;February;March;April;May;June;July;August;September;October;November;December';

then reload.

regards,

Alex

Not applicable
Author

It worked. Thanks celambarasan.