Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
poluvidyasagar
Creator II
Creator II

Expression calculation aggregration

Hi ,

I am trying to calculate lead time for each order. Each order has 2 events created assignment and finished assignment.The data is more in pivot form meaning created assignment has its own row and finished assignment has its own row. Data looks something like this:

Data1.png

Using this data, i am trying to calculate the following table: Lead time column is the only expression and all other columns are dimensions. The problem i am facing here is when i am trying to calculate lead time, I want lead time values to show up on finished assignment event and created assignment both.However, i get the lead time sometimes on created assignment and sometimes on finished assignment but not on both events.(Here is the sample table)

Data.png

Calculation for Lead time is :

Floor(24*60*Interval(Avg(aggr(Rangemin(Frac(Only({<EventId={'FinishedAssignment'},PickUp_MHA={'WSQ2'},Delivery_MHA={'2*','1*'},WeekDay-={'Sat','Sun'},Hour={">=6<=23"}>}Timestamp(EventTime_sub))),maketime(23))-
Rangemax(frac(Only({<EventId={'CreatedAssignment'},PickUp_MHA={'WSQ2'},Delivery_MHA={'2*','1*'}, WeekDay-={'Sat','Sun'},Hour={">=6<=23"}>}Timestamp(EventTime_sub))),MakeTime(6))+
NetWorkDays(Only({<EventId={'CreatedAssignment'},PickUp_MHA={'WSQ2'},Delivery_MHA={'2*','1*'},WeekDay-={'Sat','Sun'}>}Timestamp(EventTime_sub)),
Only({<EventId={'FinishedAssignment'},PickUp_MHA={'WSQ2'},Delivery_MHA={'2*','1*'},WeekDay-={'Sat','Sun'}>}Timestamp(EventTime_sub))-1)*MakeTime(8),OrderNumber1)),'mm'))

I would like my table to be like the following:

 

Data3.png

I do not understand what is causing this issue. Can anyone please help?

Thanks,

Vidya Sagar

Labels (1)
1 Solution

Accepted Solutions
fosuzuki
Partner - Specialist III
Partner - Specialist III

Hi,

try adding total<OrderNumber1>

 

change:

Avg(aggr(

 

to:

avg(total<OrderNumber1> aggr(

View solution in original post

2 Replies
fosuzuki
Partner - Specialist III
Partner - Specialist III

Hi,

try adding total<OrderNumber1>

 

change:

Avg(aggr(

 

to:

avg(total<OrderNumber1> aggr(

poluvidyasagar
Creator II
Creator II
Author

Thank you..It worked