Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
drohm002
Creator
Creator

Inline Table

Hi, I have a field called "Age" with values ranging from 1 - 10,000.  The age is in days.  I want to create a multibox filter with this field but I want the age to be displayed in years when the end user clicks the drop down.  So I need a way to categorize and say, 1 to 365 days = 1 year, 366 to 730 days = 2 years, etc.  Do I do this with an inline table, if so, how do I construct that?  thanks!

1 Solution

Accepted Solutions
sunny_talwar

May be like this

Table:

LOAD RecNo() as Age,

If(RecNo() <=730, Ceil(RecNo()/30) & ' month/s', Ceil(RecNo()/365) & ' year/s') as Flag

AutoGenerate 10000;

View solution in original post

10 Replies
sunny_talwar

May be like this

LOAD RecNo() as Age,

     Ceil(RecNo()/365) as Year

AutoGenerate 10000;

drohm002
Creator
Creator
Author

is RecNo equal to my field "Age"?

sunny_talwar

RecNo() will create  1-10000 in ascending order... which will join to you main table which include Age.

drohm002
Creator
Creator
Author

so is this an inline table? do I put the word inline anywhere?  does this go in the script?

sunny_talwar

You don't need Inline Table with 10000 lines to do what can be done with a simple load of 3 lines. and yes, this does go in the script

drohm002
Creator
Creator
Author

I gotcha.  Now, is there a way to amend this so that of the values 0 - 730 days, it calculates the age in months, instead of years?  I still want it to calculate years for any values over 730

sunny_talwar

How will you divide the values?

1-30 Month1?

31-60 Month2?

and so on....?

drohm002
Creator
Creator
Author

yes...

drohm002
Creator
Creator
Author

can I get the output to actually say "2 months", instead of just 2