Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
saumyashah90
Specialist
Specialist

Convert Dates into month and year

Hi friends,

I have a Date Column.

trade_date
2015-03-01
2015-03-07
2015-04-06
2015-04-02
2015-04-01
2014-12-23
2014-12-14

I want out put as

output
Mar 2015
Apr 2015
Dec 2014

When I select Mar 2015, data of all dates of march should be selected.

Help

7 Replies
PrashantSangle

Hi,

use Monthname()

or

date(datefield,'MMM YYYY')

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Anonymous
Not applicable

First you need to check if your dates are in date format or not.

if they are in date format and you need to include one more column in script

load

Trade_date,

MonthName(Trade_date) as MonthYear


from table;


Now you can use this field as list box for filtering the data. And when you will select one month it will select all the dates for that particular month Year .


Thanks

BKC

Not applicable

Hi Saumya,

is trade_date a proper date or a string?

If it's not a proper date you'll need to use date#

Date(Date#(trade_date, 'YYYY-MM-DD'),'MMM YYYY')

hope that helps

Joe

rajkumarb
Creator II
Creator II

HI

Try this in the List Box by choosing expression and use this

=Date( MonthStart(Trade_date), 'YYYY-MMM')

or as Max dreamer & Balakumar mentioned use MonthName(Trade_date)

sasiparupudi1
Master III
Master III

Add another field in your load script

load

trade_date,

Date(Date#(trade_date, 'YYYY-MM-DD'),'MMM YYYY') as [trade date MMM YYYY],

...

..

from your data source;

hth

Sasi

ahmar811
Creator III
Creator III

Date(Date#(trade_date,'YYYY-MM-DD'),'MMM YYYY')

MarcoWedel

Hi,

one solution to create both date and month could be:

QlikCommunity_Thread_181791_Pic1.JPG

LOAD *,

        MonthName(trade_date) as trade_month;

LOAD Date#(trade_date,'YYYY-MM-DD') as trade_date

FROM [https://community.qlik.com/thread/181791] (html, codepage is 1252, embedded labels, table is @1);

hope this helps

regards

Marco