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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out 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,

Labels (1)
2 Replies
tresB
Champion III
Champion III

Try like:

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

sunny_talwar
MVP
MVP

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.