Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Setanalysis with getfieldselection field issues

I need help to understand what is going wrong with my syntax of getfield used in conjunction with set analysis

I am trying count the number of tickets when the user selects the field in the list box  titled 'Ticket Type'. I have used the below syntax but it shows an error in the set modifier when i type the below. I am not able to understand what is going wrong with it Can somebody please help me?

count(distinct {<Ticket_Type = {=getfieldselection(Ticket_Type)}Incident>})

20 Replies
Anonymous
Not applicable
Author

Attaching the screenshot of the syntax. values appear blank. though it states that the expression is ok..normally the formulas should appear in blue but is not the case.

sunny_talwar

I have no idea why you need GetFieldSelections here? Can you elaborate the requirement a little more?

tresesco
MVP
MVP

There are few bracket issues. Try to copy the expression suggested above and try.

tresesco
MVP
MVP

Perhaps, he wants the output on selection only. I.e. - no result until any selection is there.

t_chetirbok
Creator III
Creator III

I think it should be $ not &

count(distinct {<Ticket_Type = {"&(=getfieldselections(Ticket_Type))"}>} Incident)


count(distinct {<Ticket_Type = {"$(=getfieldselections(Ticket_Type))"}>} Incident)

tresesco
MVP
MVP

. Thanks.

sunny_talwar

In that case, what about this approach that Stefan mentioned?

=If(GetSelectedCount(TicketType) = 1, Count(DISTINCT Incident))

or

=If(GetSelectedCount(TicketType) >= 1, Count(DISTINCT Incident))

or

Count(DISTINCT Incident) * RangeMin(Alt(GetSelectedCount(TicketType), 1), 1)

Anonymous
Not applicable
Author

It worked the second time when i pasted it. Thanks for the explanation. I learnt something new.

Anonymous
Not applicable
Author

Thanks for the syntax.. It worked.

Anonymous
Not applicable
Author

It worked with the $ syntax as count(distinct {<Ticket_Type = {"$(=getfieldselections(Ticket_Type))"}>} [Incident])