Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to display date in month-year format

Hi,

Date in excel table is in this format- Jan-10 and i want it to be same in  QV, but m getting as 40179.

what to write in EditScript?

Month as ----------

Thanks in Advance

Sagar Gupta

1 Solution

Accepted Solutions
Not applicable
Author

Try this

Date(MDate,'MMM-YY') as MonthYear

View solution in original post

10 Replies
christophebrault
Specialist
Specialist

Hi,

You can try MonthName(YourDate). This function gives you the month as defined in the SET MonthNames at the beginning of your script, and the year.

Inscrivez vous à ma Newletter Qlik
DoNotMissQlik- Connect with me on Linkedin
SunilChauhan
Champion
Champion

MonthName(fieldname ) as MonthYear

Sunil Chauhan
Not applicable
Author

Hi,

Thanks for reply.

I tried: Load MonthName(Months) as MonthYear,    where Months is my feild name containing dates in this format(Jan-10).

😞 Its not working, my chart showing " no data to display"

Regards

Sagar Gupta

Not applicable
Author

Try this

Date(MDate,'MMM-YY') as MonthYear

SunilChauhan
Champion
Champion

better you can share sample file.

Sunil Chauhan
Not applicable
Author

Hi,

Thanks for reply.

I tried: Load MonthName(Months) as MonthYear,    where Months is my feild name containing dates in this format(Jan-10).

😞 Its not working, my chart showing " no data to display"

Regards

Sagar Gupta

its_anandrjs

Hi,

Which type of chart you creating.

Regards,

Anand

adhudson
Creator II
Creator II

Hi,

     You can format the given date with the date function like below.

     Date(givenDate,'MMM-YYYY') returns any date in MMM-YYYY format.

     But remember it is just the formatting of the date.

     Lets say if you have two dates for the same month as 29/04/2012 and 30/04/2012.

     For both of the dates, the above formatting function returns Apr-2012. But still the original values are not changed.

     So if you use this as a dimension in a chart, it will show 'n' number of same values 'Apr-2012' as it is available in the data. In this case, you can see two Apr-2012s in the chart.

     If you feel any problem with this solution, there is always another way of doing it.

     Date(MakeDate(Year(givenDate),Month(givenDate),1),'MMM-YYYY') AS anotherDateColumn.

     You can use this to create new column 'anotherDateColumn'.

     So you will get the table like the below.

     givenDate     anotherDateColumn

     29/04/2012     Apr-2012 (Original Value:01/04/2012)

     30/04/2012     Apr-2012 (Original Value:01/04/2012)

Regards

Andrew Hudson

SunilChauhan
Champion
Champion

you can also try this

MonthName(makedate(20&  right(Month,2),num(left(Months,3)))) as MonthName

Sunil Chauhan