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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Avg Number of Days across fields...

Hello,

I am attempting to calculate the average number of days that a record is late.  there are 5 Status choices, so they would all need to be added and then averaged.  So it might look like this.

StatusDays Lat
Status 1

5

Status 210
status 33
Status 4

20

Status 52

Total Days 40

Average 8 days

this is the formula I am working on.  I can get the Sum of the days, but Im not seeing how to average them.  Any thoughts?

Sum(if([Status 1 Due] - if(ISNULL([Status 1 Actual]),Today(),[Status 1 Actual]) < 0, if(ISNULL([Status 1 Actual]),Today(), [Status 1 Actual]) - [Status 1 Due]))

Sum(if([Status 2 Due] - if(ISNULL([Status 2 Actual]),Today(),[Status 2 Actual]) < 0, if(ISNULL([Status 2 Actual]),Today(), [Status 2 Actual]) - [Status 2 Due]))

1 Reply
sunny_talwar

May be like this:

(Sum(if([Status 1 Due] - if(ISNULL([Status 1 Actual]),Today(),[Status 1 Actual]) < 0, if(ISNULL([Status 1 Actual]),Today(), [Status 1 Actual]) - [Status 1 Due]))

+

Sum(if([Status 2 Due] - if(ISNULL([Status 2 Actual]),Today(),[Status 2 Actual]) < 0, if(ISNULL([Status 2 Actual]),Today(), [Status 2 Actual]) - [Status 2 Due]))

+

.....) / Count(DISTINCT Status)