Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
sirivis24s
Partner - Contributor
Partner - Contributor

How to calculate difference using single date field

Hi All,

I am New to QlikView  I have data like

Change datechanger Old assigned to New Assigned toOld statusNew StatusNameDTAT
11/1/2020Sujan  Darrielle New--
11/4/2020Darrielle DarrielleSujanNewNeed More infoDarrielle3
11/4/2020Sujan SujanDarrielleNeed More infoOpenSujan1
11/4/2020Darrielle DarrielleDhruvOpenOpenDarrielle1
11/12/2020Dhruv DhruvDhruvOpenFixedDhruv7
11/15/2020Dhruv DhruvSujanFixedReady to retestDhruv2
11/21/2020Sujan Sujan Ready to retestClosedSujan5

 

I need to Calculate  no of days between dates for eg

changed date is 11/1/2020 to 11/4/2020  then DTAT is 3 excluding Saturday's and Sundays .below is criteria 

 

 

Thanks

Sujan.s

11 Replies
Taoufiq_Zarra

@sirivis24s  you can use networkdays function

networkdays (start_date, end_date )

for example

 

 

=networkdays (Date#('11/1/2020','M/D/YYYY') , Date#('11/4/2020','M/D/YYYY')) 

 

 

output is 3

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
sirivis24s
Partner - Contributor
Partner - Contributor
Author

Hi Taoufiq,

How can I split Change date into multiple dates i.e, start date and enddate

 

 

 

sirivis24s
Partner - Contributor
Partner - Contributor
Author

Based on AU_Entity_ID 

sirivis24s_0-1604570430838.png

 

sirivis24s
Partner - Contributor
Partner - Contributor
Author

Hi Taoufiq

There are multiple Au_entityID for eg i am showing single entity

sirivis24s_1-1604570854448.png

based on above screen shot how can calculate start date and enddate in network days

 

Taoufiq_Zarra

@sirivis24s  in Script you can use for example :

load *,networkdays(Date#(peek([Change date]),'M/D/YYYY'),Date#([Change date],'M/D/YYYY')) as DTAT;
LOAD * INLINE [
    Change date, changer,Old assigned to , New Assigned to, Old status, New Status, Name
    11/1/2020, Sujan, , Darrielle,  , New
    11/4/2020, Darrielle,  Darrielle, Sujan, New, Need More info, Darrielle
    11/4/2020, Sujan,  Sujan, Darrielle, Need More info, Open, Sujan
    11/4/2020, Darrielle, Darrielle, Dhruv, Open, Open, Darrielle
    11/12/2020, Dhruv, Dhruv, Dhruv, Open, Fixed, Dhruv
    11/15/2020, Dhruv, Dhruv, Sujan, Fixed, Ready to retest, Dhruv
    11/21/2020, Sujan, Sujan,  , Ready to retest, Closed, Sujan
];

output:

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
sirivis24s
Partner - Contributor
Partner - Contributor
Author

Hello Taoufiq,

I have tried but it's not working i have attached sample QVW file and Datafile

please help me on this

Taoufiq_Zarra

@sirivis24s 

there is a lot of data source in the qlik file
can you specify the part where you want to apply the function

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
sirivis24s
Partner - Contributor
Partner - Contributor
Author

Hello Taoufiq

You can apply at Audit Log Tab

Thanks

sujan.s

 

 

sirivis24s
Partner - Contributor
Partner - Contributor
Author

Hello,

I have used below forumla but it's not working in audit log tab i have taken staright table with expression 

count(DTAT)

AUDIT_LOG1:
load *,network days(Date#(peek("AU_DATE"),'M/D/YYYY'),Date#("AU_DATE",'M/D/YYYY')) as DTAT
Resident AUDIT_LOG;
Drop Table AUDIT_LOG;