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 expression


Hello

I have an expression in a table

max([Actual Completion Date]) - min([Actual Start Date])

I would like to have the average of this expression

Avg(max([Actual Completion Date]) - min([Actual Start Date]) )

This does not work.

The min and max is dependent on dimensions, I know.

Any ideas how to solve this?

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

If you need to nest aggregation functions you need to use the aggr function:

avg(aggr((max([Actual Completion Date]) - min([Actual Start Date]),Dim1, Dim2 ... ))

Replace Dim1, Dim2 ... with the dimensions over which min and max need to be aggregated.


talk is cheap, supply exceeds demand

View solution in original post

4 Replies
Not applicable
Author

Hi ,

Try this interval(Avg(max([Actual Completion Date]) - min([Actual Start Date]) ))

tresesco
MVP
MVP

I guess you have to use TOTAL keyword (though that depends on your requirement).

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

If you need to nest aggregation functions you need to use the aggr function:

avg(aggr((max([Actual Completion Date]) - min([Actual Start Date]),Dim1, Dim2 ... ))

Replace Dim1, Dim2 ... with the dimensions over which min and max need to be aggregated.


talk is cheap, supply exceeds demand
Not applicable
Author

It worked!

Hats off!