Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
jim_chan
Specialist
Specialist

Date format convert to numeric

Hi guys,

i was trying to convert a date(End Date) column to numeric,

this is the expression i wrote down:

num(MonthEnd(MakeDate(Year(Date#(myear,'YYYY')),Month(Date#(mymonth,'MMMM'))))) as EndDate

End Result: 42400.9939292 .

Problem: how to get rid of the .9939292?

Rgds

Jim

1 Solution

Accepted Solutions
avinashelite

Try like this

floor(num(MonthEnd(MakeDate(Year(Date#(myear,'YYYY')),Month(Date#(mymonth,'MMMM')))))) as EndDate

View solution in original post

5 Replies
avinashelite

Try like this

floor(num(MonthEnd(MakeDate(Year(Date#(myear,'YYYY')),Month(Date#(mymonth,'MMMM')))))) as EndDate

jim_chan
Specialist
Specialist
Author

oh... floor......

jim_chan
Specialist
Specialist
Author

thanks bro Avin

jonathandienst
Partner - Champion III
Partner - Champion III

The num() is redundant if you are using floor. It is only a format instruction so it makes no sense inside a calculation.

This (much simpler) expression should work:

=Floor(Date#(mYear & mymonth, 'YYYYMMMM'))

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
jim_chan
Specialist
Specialist
Author

Thank Jonathan,

but i need to create a end date field. So, i took out the 'num', now is as below:

floor(MonthEnd(MakeDate(Year(Date#(MyYear,'YYYY')),Month(Date#(MyMonth,'MMMM'))))) as EndDate?

How simpler can it be now ?

Rgds

Jim