Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2022, LIVE in Denver CO., May 16-19, 2022. REGISTER NOW TO RECEIVE EARLY BIRD PRICING
cancel
Showing results for 
Search instead for 
Did you mean: 
narenjln
Creator
Creator

HI, i need to calculate no of days and hour

hi from the Startdate to Enddate i need calculate the no of  days and hours,

so i have enter the expression as ,

Interval(Startdate-Enddate,'d hh:mm')

but it is not returning the value kindly clarify me.,

4 Replies
arvind_patil
Partner
Partner

Hi Lakshminarayanan,

Please  try below one:

Load

..

num(Startdate)-Num(EndDate) as NOofDays,

..

From

<path...>


Thanks,

Arvind Patil

narenjln
Creator
Creator
Author

hi need to calculate the hours also ,kindly help me out

sharmasapna
Contributor III
Contributor III

Hi Lakshminarayanan


I hope this works.

Please check below code:


set a=26/04/2017;

set b=27/05/2017 10:05:00;

let c=Interval(Date(b,'DD/MM/YYYY hh:mm:ss')-Date(a,'DD/MM/YYYY hh:mm:ss'),'DD hh:mm:ss')

Thanks

Sristi

jonathandienst
Partner
Partner

Are both Startdate and Enddate in  numerical date format, or as strings? For a quick check, create a list box for each field and check the alignment - if left aligned they are string values and you need to convert them to dates (preferably when you load them).

Something like

LOAD ....

    Date(Date#(Startdate, 'yyyy/MM/dd hh:mm')) as Startdate,

    Date(Date#(Enddate, 'yyyy/MM/dd hh:mm')) as Enddate,

    ...

(change the fomat string to match the format of the string values)


Then the syntax you used should work.

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