Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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

Re: How to get previous month name from selection box?

Try this

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

6 Replies
Not applicable

Re: How to get previous month name from selection box?

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
New Contributor II

Re: How to get previous month name from selection box?

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

Re: How to get previous month name from selection box?

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

Re: How to get previous month name from selection box?

Try this

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

Not applicable

Re: How to get previous month name from selection box?

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

Re: How to get previous month name from selection box?

It worked. Thanks celambarasan.

Community Browser