Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Convert Date format to Month

Hi,

I have a format like 17/12/2012 19:35:38 hours, i want only Month in bar chart.

11.PNG.png

Tags (2)
10 Replies

Re: Convert Date format to Month

You could use the MonthName() function in a Calculated Dimension in Bar Chart.

If possible though it would be better to create a MonthName field in your load script.

amit_saini
Honored Contributor III

Re: Convert Date format to Month

Vamsi,

Try this :

Monthname(Your_Date_Field) as Month

and call Month as dimension in bar chart.

Thanks,

AS

anbu1984
Honored Contributor III

Re: Convert Date format to Month

=Month(Timestamp#('17/12/2012 19:35:38','D/M/YYYY hh:mm:ss'))

Not applicable

Re: Convert Date format to Month

HI,

If I catch your issue correctly, I believe you can achieve what you seek just by using MONTH( Date ), either as a new field in your script (recommended), or as a Calculated Dimension in your chart.

amit_saini
Honored Contributor III

Re: Convert Date format to Month

See the attachment.

Thanks,
AS

Not applicable

Re: Convert Date format to Month

Use this it will solve your problem

=Month(Date(SubField(Timestamp(DATE_FIELD,'YYYY-MM-DD hh:mm:ss'),' ',1),'DD/MM/YYYY'))

Re: Convert Date format to Month

=Month(Timestamp#('17/12/2012 19:35:38','DD/MM/YYYY hh:mm:ss'))

or

=Date(MonthStart(Timestamp#('17/12/2012 19:35:38','DD/MM/YYYY hh:mm:ss')),'MMM YYYY')

or

=DUAL(Date(MonthStart(Timestamp#('17/12/2012 19:35:38','DD/MM/YYYY hh:mm:ss')),'MMM YYYY'),Date(MonthStart(Timestamp#('17/12/2012 19:35:38','DD/MM/YYYY hh:mm:ss')),'YYYYMM'))

Not applicable

Re: Convert Date format to Month

Thanks a lot for all your help.

Re: Convert Date format to Month

Hi,

please specify your requirements, because there are two possibilities:

1. you want the same number of bars and just replace the displayed timestamp with a month, i.e. there will be multiple occurences of each month.

2. you want to aggregate by months, i.e. the number of bars will decrease and each month will only occur once.

solutions like

Date(Date, 'MMM')

will not change the underlying numerical value of your date field but simply format the displayed text and thus keep the different bars untouched (case 1).

solutions like

Month(Date)

will change the underlying numerical value to the month number (1-12) and aggregate all dates within this month.

hope this helps

regards

Marco

Community Browser