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

Expression doesn't work as dimension

Any idea why the below expression is returning //Error in calc... when I put it in the dimension?

Alt(only({<[Classification Source]={'$(=[Classification Source1])'}>}[Asset Classification (1)]),

  only({<[Classification Source]={'$(=[Classification Source2])'}>}[Asset Classification (1)]),

  only({<[Classification Source]={'$(=[Classification Source3])'}>}[Asset Classification (1)]),

  only({<[Classification Source]={'$(=[Classification Source4])'}>}[Asset Classification (1)]),

  only({<[Classification Source]={'$(=[Classification Source5])'}>}[Asset Classification (1)]),

  'NULL_CLASS')

Class Source1-n above are islands which are user selections.

4 Replies
whiteline
Master II
Master II

Hi.

Because you have to use aggr() function for calculated dimension.

Anonymous
Not applicable
Author

I suspect there is a better way to handle your situation, but if you prefer this way, try to use aggr() around this expression:

aggr(

<your expression>

, [Asset Classification (1)]))

Not applicable
Author

the aggr() works except it doesn't populate 'NULL_CLASS' for nulls.  Would definitely be interested in a better way to handle this if you have any ideas.

EDIT: This actually doesn't resolve the issue.  It generates values for the dimension, but when I switch to a pivot, it does not group the like values together.

Anonymous
Not applicable
Author

A better way is to create an actual dimension in the data model, if possible of course.