Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Ashwini_B
Contributor
Contributor

How to calculate turn around average for a 2 dates field

i have set of dates field and want to derive the average of the days. below is the set of values for the date field (ordered date and requisition date), I need the difference of the 2 dates (as shown below) and the average for the same.

[PO-P&I]Ordered Date (Date) [REQ]Requisition Date (Date) Diff
2/23/2021 1/14/2021 40
1/11/2022 1/10/2022 1
12/12/2022 12/1/2022 11
11/22/2021 11/18/2021 4
9/21/2022 9/5/2022 16
4/30/2021 4/26/2021 4
4/30/2021 4/26/2021 4
12/12/2022 12/5/2022 7
3/31/2020 3/30/2020 1

 

 

 

Labels (1)
2 Replies
Prem0212
Creator
Creator

Can u please show me exactly what you are going to see the output???

Chanty4u
MVP
MVP

// Load the data

Data:

LOAD [PO-P&I]OrderedDate,

     [REQ]RequisitionDate,

     Interval([PO-P&I]OrderedDate - [REQ]RequisitionDate, 'DD') as Diff;

 

// Calculate the average number of days

LET AvgDays = Avg(Diff);

 

// Display the result

Trace 'Average number of days: ' & AvgDays;