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

Regarding Dates?

HI everyone,

I have a small doubt in qlikview

in my month field :the month format is 2015M07 represents July 2007

i want the Month field as July only............

i.e.,

2015M07 to july

2015M06 to june

2015M05 to May

2015M04 to Apr

like that

1 Solution

Accepted Solutions
sunny_talwar

Looking to get this?

Capture.PNG

Try this script:

Table:

LOAD Month,

  Month(MakeDate(Left(Month, 4), Right(Month, 2))) as NewMonth;

LOAD * Inline [

Month

2015M07

2015M06

2015M05

2015M04

];   

View solution in original post

11 Replies
Anonymous
Not applicable
Author

hello,

if the your datefrmat indicates that the M stands for month you might use

=date(date#(keepchar('2015M07 ','0123456789'),'YYYYMM'),'MMM')

it first reduces your string to only numbers "201507"

then formats this string as date (the date#) function

and finally formats to monthname (but only 3 charatcers e.g. Jul)

if you want more charatcers you Need to adapt  in sctipt to 4 or more characters

SET MonthNames='Jan;Feb;Mrz;Apr;Mai;Jun;Jul;Aug;Sep;Okt;Nov;Dez';

maxgro
MVP
MVP

=month(makedate(left('2015M07', 4), Right('2015M07', 2)))

replace '2015M07' with your field

Not applicable
Author

Thnx Massimo,Dis is exactly wat iam looking for,

But

i want Month field to be "Month Format" Field

as per the above formula, im getting single field in text object,

Im missing something,PLs explain

Month                 as             MonthFormat

2015M07                              Jul

2015M06                              Jun

2015M05                              May

2015M04                               Apr   

Not applicable
Author

Thnx Rudolf Linder ,

Dis is exactly wat iam looking for,

But

i want "Month" field to be "MonthFormat" Field

as per the above expression, im getting single field in text object,

Im missing something,PLs explain

Month                 as             MonthFormat

2015M07                              Jul

2015M06                              Jun

2015M05                              May

2015M04                               Apr  

sunny_talwar

Looking to get this?

Capture.PNG

Try this script:

Table:

LOAD Month,

  Month(MakeDate(Left(Month, 4), Right(Month, 2))) as NewMonth;

LOAD * Inline [

Month

2015M07

2015M06

2015M05

2015M04

];   

sasiparupudi1
Master III
Master III

LOAD Month,

  Month(Date#(PurgeChar(Month,'M'),'YYYYMM')) as MonthFormat;

LOAD * Inline [

Month

2015M07

2015M06

2015M05

2015M04

];   

Kushal_Chawda

Try,


Data:

LOAD *,

Month(Date#(left(MonthText,4) & right(MonthText,2),'YYYYMM')) as Month,

Year(Date#(left(MonthText,4) & right(MonthText,2),'YYYYMM')) as Year,

monthname(Date#(left(MonthText,4) & right(MonthText,2),'YYYYMM')) as MonthYear

Inline [

MonthText

2015M07

2015M06

2015M05

2015M04

];  

Not applicable
Author

Hi Himesh,

Try like this,

month(makedate(left('2015M07',4), Right('2015M07',2))) as MonthName

take listbox and select this MonthName It display only months jul,jun...

Anonymous
Not applicable
Author

it is still a date field and only formatted as string "monthname"

you can Format it to your liking