Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
AWS Degraded - You may experience Community slowness, timeouts, or trouble accessing: LATEST HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to calculate days in between dates in straight table? urgent help please


Hi,

I have data as below. I need to calculate days between highlighted dates. please can anyone suggest me how to do this?

the condition is when STAGE2 =CC and STAGE2=MR then need to calculate days between DATE 28/01/2015 12:00 and 01/04/2015 18:28                                                                                                 

IDSTAGE1STAGE2DATE
43998CMAP18/05/2015 15:32
43998PDCM24/04/2015 14:24
43998DTDPD08/04/2015 14:11
43998MRC08/04/2015 14:10
43998DMR01/04/2015 18:28
43998DAD01/04/2015 18:01
43998REDA28/03/2015 17:14
43998RARE28/03/2015 16:38
43998CPRA13/03/2015 16:49
43998CSCP27/02/2015 13:30
43998QRCS27/02/2015 13:29
43998ELQR27/02/2015 13:28
43998TAEL11/02/2015 14:51
43998CCTA11/02/2015 14:51
43998CCCC28/01/2015 13:30
43998LGCC28/01/2015 12:00

Thanks.

23 Replies
anlonghi2
Creator II
Creator II

Hi Amelia

please look at the attached doc: the table show days between dates where the condition is true.

Best regards

Andrea

sunny_talwar

What exactly is not working?

Not applicable
Author

Thanks. when I sued the expression entire table is showing as blank. please help

Not applicable
Author

when we checked for individual IDs values are not showing correct. do I need to change anything?

Not applicable
Author

Thanks. I have used this table showing all blanks.

Digvijay_Singh

you need to share sample data where it is not working, what I proposed was based on earlier sample, where set analysis was used to identified min date where Stage2 is MR and CC and subtracted the resulted date as you needed. By mistake I used max for one of the date, pl check if that is a problem or better share the sample where it is not working.

anlonghi2
Creator II
Creator II

Hello Amelia,

I made some changes to the doc (script and table).

Please let me know if now it's ok you.

Best regards

Andrea

Not applicable
Author

Thanks. values are not showing correct. when I used for all IDs

anlonghi2
Creator II
Creator II

Amelia, I duplicated your data and the doc seems to work. Look at the following print screen that show the correct number of days between dates.

Have you modified your load script using mine as example ?

DiffDateAmelia.png

Not applicable
Author

Thanks. Yes I have used the same script. number of days is showing correct now when we checked for individual IDs.

if I want to calculate Median how to do this?

suppose if I want to check the Median of IDs 32432 and 32325

ID 32432 have number of days 314

ID 32325 have number of days 415

for above Median is 364.5 (calculated in excel)

how to calculate Median for all IDs in straight table. please help.