Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
krishna20
Specialist II
Specialist II

Date Problem

Hi Folks,

I'm facing a strange problem not able to troubleshoot it where the mistake is.

In my dashboard i'm showing last three years in list box, under that showing calendar objects from selecting the data range.

My requirement is in on active sheet max year should select in listbox and in the From calendar, Date(Yearstart(Max(Date_Field))) to be selected and in the To Calendar Date(Addmonths(Max(Date_Field),0)) need to select .

If i select 2014 , the calendar object should change from 01/01.2014 to 31/12/2014 dynamically.

The above one i achieved. The problem is , the above task i achieved in my personal desktop. When i'm trying to do the same thing in the client's server it's not working. Each and every variable i did a copy & paste. But, it's not  working.

Qlikview i'm using personally is 11.20 SR10

My Clients Qlikview is 11.20 SR5

Is this the problem?or anything.Please suggest me .

Regards

Krishna

27 Replies
ToniKautto
Employee
Employee

I think the main problem is that you have assumed that YearStart() returns a date value. The function actually returns a timestamp, so you need to numerically transform that into a integer to match you date values.

Date(Round(Yearstart(Max(Date_Field))))



EDIT: The timestamp decimal can be forced to integer by using Round().

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Are you saying that the QlikView documentation/help decided to digress from reality again?

QV Help tells me that YearStart returns the timestamp of the first millisecond of the year, which is 00:00:00.000. IIRC that value translates into a zero fraction.

You know something that we don't?

Peter

krishna20
Specialist II
Specialist II
Author

Actually my date is in time stamp format from database. That's the reason choosing Yearstart().

ToniKautto
Employee
Employee

Well, it does not matter if your incoming format is timestamp. The output form YearStart() is still a decimal value, and you need to ensure it becomes a properly formatted date.

Actually, considering the floating point value I have edited my suggestion above.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Of course you were right about the Date(). I was just talking about the Floor() function which - AFAIK - doesn't return an integer.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

BTW you're sure you want to state that Date(YearStart()) occasionally returns Dec 31st in QlikView?

ToniKautto
Employee
Employee

Floor() and Round() returns a number. This number will be a integer if you use the default base and offset.

num floor(x [ , base [ , offset ]])

num round( x [ , base [ , offset ]])


The 31 Dec is the consequence of when the YearStart() timestamp round downwards, as in my example 40522.999999999999. This s why I changed my previous comment to Round(), as this will correct the rounded integer to 40523.

krishna20
Specialist II
Specialist II
Author

Hi Tony,

Can you please apply this logic in my sample app SR5. Because , using yearstart() working correctly in SR11 app. Little confused.

ToniKautto
Employee
Employee

Does it make any difference if you add the Round() ?

krishna20
Specialist II
Specialist II
Author

No Tony, I need to see correct format date in Calendar object.It's not converting or round the digits.