Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
rahulsingh12
New 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,

Tags (1)
2 Replies
MVP
MVP

Re: Age Calculation

Try like:

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

Re: Age Calculation

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.