Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I want to know the count of number of days between two dates.
The dates are calculate in the form of two variables vPeriodFrom and vPeriodTo.
For example If vPeriodFrom is 01012015 and vPeriodTo is 28022015
The count of days should be 59.
How can i calculate this. Please help.
well, if you have real date (or num(date)) format in your valiables, it will be simple:
=vPeriodTo - vPeriodFrom + 1
if you have exactly what you'he written, you first need to make this variables become real dates, so qlik will understand them:
= MakeDate(right(vPeriodTo, 4), left(right(vPeriodTo, 6), 2), left(vPeriodTo, 2))
- MakeDate(right(vPeriodFrom, 4), left(right(vPeriodFrom, 6), 2), left(vPeriodFrom, 2)) + 1
Or you can try this also (if it isn't date format)
Num(Date#(vPeriodTo, 'DDMMYYYY') - Num(Date#(vPeriodFrom, 'DDMMYYYY')) + 1
Hi,
How about using NetWorkDays function
NetworkDays($(vPeriodFrom) , $(vPeriodTo), {, holiday})
Well networkday will exclude weekends and the count of days will be less than 59. He needs to count all the days, so networkday won't work here.
replace with your variables
=date#('28022015', 'DDMMYYY') - date#('01012015', 'DDMMYYY') +1