Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Time to deadline

Hello,

Can any body help me to count time to deadline ?

I have a table

     Task          Deadline

     1               20 Aug 15:00

     2               25 Aug 16:00

     3               12 Sep 11:00

I would like to count how many 'SS:MM:DD' is form now to this stepping forward deadline

Thank you in advance

1 Solution

Accepted Solutions
MarcoWedel

Hi,

one solution could be:

QlikCommunity_Thread_176499_Pic1.JPG

QlikCommunity_Thread_176499_Pic2.JPG

table1:

LOAD *,

    Day(Deadline) as  DDay,

    Month(Deadline) as DMonth,

    Year(Deadline) as DYear;

LOAD Task,

    Timestamp(SetDateYear(Timestamp#(Deadline,'DD MMM hh:mm'),Year(Today())),'DD MMM hh:mm') as Deadline

INLINE [

    Task, Deadline

    1, 20 Aug 15:00

    2, 25 Aug 16:00

    3, 12 Sep 11:00

];

replacing the year with the current year.

hope this helps

regards

Marco

View solution in original post

6 Replies
julian_rodriguez
Partner - Specialist
Partner - Specialist

Please find attachement

Not applicable
Author

Thanks for support

but I would like to have text object which will countdown how many days,hh:mm:ss I have to earliest task not a table

Also I think I have a problem with a date format because if I write:

Day(Date#(Deadline,'DD/MM/YYYY')) as  DDay,

Month(Date#(Deadline,'DD/MM/YYYY')) as DMonth,

Year(Date#(Deadline,'DD/MM/YYYY')) as DYear;

in Table viewer is like below

Time format in script I have defaults settings

SET TimeFormat='hh:mm:ss';

SET DateFormat='YYYY-MM-DD';

SET TimestampFormat='YYYY-MM-DD hh:mm:ss[.fff]';


Thank you in advance

Not applicable
Author

Can somebody help ?

yura_ratu
Partner - Creator II
Partner - Creator II

Hi,

Try this

Day(Date#(Deadline,'D MMM hh:mm')) as  DDay,

Month(Date#(Deadline,'D MMM hh:mm')) as DMonth,

Year(Date#(Deadline,'D MMM hh:mm')) as DYear;

The problem is - you don't have a year in your Deadline date, so you need to add it manually, something like this

= MakeDate(

2015,

month(date#('8 Aug 11:15', 'D MMM hh:mm')),

day(date#('8 Aug 11:15', 'D MMM hh:mm'))

)

yura_ratu
Partner - Creator II
Partner - Creator II

Hi,

You need to get your dates in correct format, as I described here Re: Time to deadline

And then calculate difference between today and earliest task TimeDif = min(Deadline) - today(), then  do this in texbox

= Floor(TimeDif )&', '&Time(Frac(TimeDif ),'hh:mm:ss')

for getting how many days,hh:mm:ss you have to earliest task in a table

MarcoWedel

Hi,

one solution could be:

QlikCommunity_Thread_176499_Pic1.JPG

QlikCommunity_Thread_176499_Pic2.JPG

table1:

LOAD *,

    Day(Deadline) as  DDay,

    Month(Deadline) as DMonth,

    Year(Deadline) as DYear;

LOAD Task,

    Timestamp(SetDateYear(Timestamp#(Deadline,'DD MMM hh:mm'),Year(Today())),'DD MMM hh:mm') as Deadline

INLINE [

    Task, Deadline

    1, 20 Aug 15:00

    2, 25 Aug 16:00

    3, 12 Sep 11:00

];

replacing the year with the current year.

hope this helps

regards

Marco