Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Need to calculate Age by First Date

I have a group that has two start dates, and I need to calculate the age of the group by subtracting the first start date from Today(). I have used firstsortedvalue some, but that is selecting an amount that goes along with the first date.

Example:

First Date: 1/1/2014

Second Start Date: 3/1/2014

Need a formula to calculate Today() - First Date(1/1/2014)= Answer.

Any help you can offer will be greatly appreciated.

1 Solution

Accepted Solutions
martynlloyd
Partner - Creator III
Partner - Creator III

If dates are in same field use
Interval(Today() - Min(StartDate),'D')

View solution in original post

5 Replies
martynlloyd
Partner - Creator III
Partner - Creator III

Interval(Today() - First Date(1/1/2014),'D') will give you the age in days...

simenkg
Specialist
Specialist

In your script define an Age field:

let vToday = Today();

load

$(vToday)-StartDate as Age


Then you can have the max age of a group as:

sum(aggr(max(Age),Group))

I do not know the name of your fields or your tables, so you have to adapt this to your application

Hope this helps
Regards
SKG

MK_QSL
MVP
MVP

Age(Today(),FirstSortedValue(Date,Date))

martynlloyd
Partner - Creator III
Partner - Creator III

If dates are in same field use
Interval(Today() - Min(StartDate),'D')

Not applicable
Author

Hi Bradley .

is what you need?

Regards!

DD