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: 
rahulsingh12
Contributor III
Contributor III

Age Calculation

Hi I have a date column A.

I want to write an expression where I am calculating age(Column B-Column A or Column B-Today() ) by using another column B.

Now I want to select column A and column B for age calculation if any value is selected from Column A and if no value is selected from column A then today's date should be selected.


Regards,

2 Replies
tresesco
MVP
MVP

Try like:

Age( ColumnB , If( GetSelectedCount(ColumnA)=1, ColumnA, Today()))

sunny_talwar

You might be able to use this (with a slight issue)

Age(Column B, Alt(Column A, Today()))

The issue is that if in case for a particular selection there is only a single value for Column A, then it will pick Column A even if you have not explicitly selected it. In all other scenarios, this should work the same way as tresesco‌'s solution above.