Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Qlik Cloud Maintenance is scheduled between March 27-30. Visit Qlik Cloud Status page for more details.
Showing results for 
Search instead for 
Did you mean: 

Age calculation


Need help calculating average age using this expression:

Average(Age (service_date, entry date) where

Service Name = "Service" and Entry Provider = "Provider1"

2 Replies
Creator II
Creator II

Is age the difference between service_date and entry_date?

Try creating a Age field in your load script (something like (service_date - entry_date) AS Age

Then use the Age field in your average:

Avg({$<ServiceName={'Service'}, EntryProvider={'Provider1'}>} Age)

Specialist II
Specialist II

the age function only returns years.

As William said, you could put the difference as a new field, but you can also just do it in an expression:

Avg({$<ServiceName={'Service'}, EntryProvider={'Provider1'}>} service_date - entry_date)

If you are looking to group the average by Service and Provider, then you'd need to use Aggr()

Avg(Aggr(Avg(service_date - entry_date),ServiceName,EntryProvider))