Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content
Announcements
WEBINAR April 23, 2025: Iceberg Ahead: The Future of Open Lakehouses - REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

'Only' function with set analysis does not work with non-numerical fields

When using 'only' in set analysis for dynamic functionality, it seems to work well with numerical fields but not character ones. 

The classic year example from the manual displays:

sum( {$<Year = {$(=Only (Year))}>} Sales

This works just fine as year is a numerical field.  

However trying to use 'only' with a character field like below:

sum({$<Facility -= {$(=Only(Primary_Facility))} >} Sales)

In the above example I am trying to select all facilities except the primary facility.  I am aware that I can use 1-$ but this is the only field I wish use the 'inverse' ability.

I'm a bit confused as to why this would not work.

Any help is appreciated.  Thank you in advance!

1 Solution

Accepted Solutions
Not applicable
Author

dont you need to put ' ' infront of ? due to its a string.

Variable:

vPrimary = only(Primary_facility)

Expression:

sum({$<Facility -= {'$(vPrimary)'} >} Sales)


View solution in original post

4 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Did you actually select only one value for Primary_Facility?

It works fine for me. See attached example.

It would help if you could post a representative sample of the document you're working with. See here for how to create such an example.


talk is cheap, supply exceeds demand
Not applicable
Author

dont you need to put ' ' infront of ? due to its a string.

Variable:

vPrimary = only(Primary_facility)

Expression:

sum({$<Facility -= {'$(vPrimary)'} >} Sales)


Anonymous
Not applicable
Author

If it should work without selecting one value in Primary_Facility, try this:

sum({$<Facility -= P(Primary_Facility) >} Sales)

Regards,

Michael

Not applicable
Author

Three years of QlikView and certified in developer and still making the rookie mistakes.  I am shame faced.  Thanks so much for your help guys, sorry for the bother.