Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Computing for Days Delayed

Hello,

I would like to compute for the days delayed in my file. The problem is, the date that I have to compute is only located in 1 field.

Please see attached file!

Thanks,

Donna

********************[UPDATE]****************************

Since we can now compute the days delayed (answer provided by Flipside).. I have a situation which I have to input in an input box,

ex: Days Delayed [input box]: 3, if I input a number, it will only display the days delayed which is equal to 3.

is this possible?

Thanks a bunch!

-Dona

11 Replies
flipside
Partner - Specialist II
Partner - Specialist II

Hi Donna,

If I've understood correctly, I think this is what you can do in an expression ..

=if(left(no#,1)='b',date-aggr(min(total <id> date), id, no#))

.. however wouldn't it be easier to associate the dates in script?

I'm assuming you only have 2 dates (a & b).

flipside

Not applicable
Author

worked like a charm!

thank you flipside!

it gave me an idea

Not applicable
Author

Hi flipside!

I got a question regarding this one!

Since we can now compute the days delayed.. I have a situation which I have to input in an input box,

ex: Days Delayed [input box]: 3, if I input a number, it will only display the days delayed which is equal to 3.

is this possible?

Thanks a bunch!

-Dona

Not applicable
Author

b.u.m.p~

flipside
Partner - Specialist II
Partner - Specialist II

If you have no other expressions, then you could amend the formula as ...

=if(  if(left(no#,1)='b',date-aggr(min(total <id> date), id, no#))  =daysDelayed,daysDelayed+.001)

... I have added 0.001 to the value and set the number presentation to integer to force zeroes to show if you need them to.

If you have to have other expressions, then the only way might be to set the background colour in the expression to highlight the matching values.

flipside

EDIT: Where daysDelayed is the variable linked to your input box! Should have made that clear!

Not applicable
Author

up!

Not applicable
Author

Hi!

Thanks for the reply! is it possible that if I input something on the input box, it will only show the items that the value of days delayed inputted?

ex: if I input days delayed : 2

then it will only show all the days delayed for 2 days

Thanks!

flipside
Partner - Specialist II
Partner - Specialist II

My earlier reply should give you that - does it not work for you?

=if(if(left(no#,1)='b',date-aggr(min(total <id> date), id, no#))=daysDelayed,daysDelayed+.001)

... the original formula (in italics) is used inside another if statement (the bold part) and it just checks if the formula equals the inputted value (I'm using daysDelayed as my variable name). If there is a match then return the formula (I added 0.001 to force zeroes to show) else do nothing - ie. return Null().

If this is the ONLY expression, then the table should reduce to only those valid rows, but if other expressions are in effect then THIS expression may show as a Null value.

flipside

Not applicable
Author

it works. alright, i'll get back to you as soon as I get back on that expression. Thanks!