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: 
Not applicable

functions inside set analysis

Hi,

Can I use functions inside set analysis, like so:

sum({$<ReservationDate={getfieldSelections(OtherReservationDate)}>} Sales)


Thanks!

2 Replies
johnw
Champion III
Champion III

Yes, but the syntax is very ugly:

sum({<ReservationDate={$(=chr(39) & replace(getfieldselections(OtherReservationDate),', ',chr(39) & ',' & chr(39)) & chr(39))}>} Sales)

The getfieldselections() function returns a list of comma separated values. I don't think set analysis likes that format, though. I believe it wants them in quotes, which is where the replace() and all the chr(39) values come in.

A much easier approach to at least try would be to use an IF. I suspect it would be slower, but it's hard to know without testing.

sum(if(ReservationDate=OtherReservationDate,Sales))

I haven't tested either. Might have bugs.

elif-tutuk
Former Employee
Former Employee

You can also compare 2 fields in set analysis. Thanks!

sum({$<ReservationDate=OtherReservationDate}>} Sales)