Skip to main content
Announcements
Save $600 on Qlik Connect registration! Sign up by Dec. 6 to get an extra $100 off with code CYBERSAVE: REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Need an alternative function to Only() so as to return multiple values

Hi,

I am facing an issue where I need to constraint the months within the Application only if we have the data present for all the dates of that respective month present in the Application.

I have written the following expressions but it is unable to return multiple values as Only() works returns only a single value, in case of multiple values it returns NULL. I need to display these values within a list box.
I need to display multiple values for the field Month_name wrt the values that we get for month_calendar.

The expression which I am currently using is as follows:

     =only( {<month_calendar = P({<month_calendar-={$(Variable6)}>} month_calendar)>} Month_Name)

I did try the following expression as well, but was unable to make it work within the list box, where this expression works perfectly in a text box but that's not the requirement.

     =Concat({<month_calendar=P({<month_calendar = {$(Variable6)}>}month_calendar)>} distinct Month_Name,',')

The final expression that I am using is

=if($(Variable1)=$(Variable2),Month_Name,(only( {<month_calendar = P({<month_calendar-={$(Variable6)}>} month_calendar)>} Month_Name)))

where,

Variable 6=max(month_calendar)

Variable 1=date(Max(MakeDate(left(dateid,4))+(right(dateid,3)-1)),'DD/MM/YYYY')

Variable 2=(date(MonthEnd(max(Date)),'DD/MM/YYYY'))

If the condition is not met, this expression returns NULL, that is the issue.
Please suggest an alternative to fix this challenge.

1 Solution

Accepted Solutions
tresesco
MVP
MVP

For list box, try like:

=Aggr(only( {<month_calendar = P({<month_calendar-={$(Variable6)}>} month_calendar)>} Month_Name) , Month_Name)

View solution in original post

2 Replies
tresesco
MVP
MVP

For list box, try like:

=Aggr(only( {<month_calendar = P({<month_calendar-={$(Variable6)}>} month_calendar)>} Month_Name) , Month_Name)

Anonymous
Not applicable
Author

Thanks Tresesco, it worked