Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
isaiah82
Creator III
Creator III

Translate calculated dimension

Say I have a calculated dimension that returns one of four values: 1,0,-1, or Null()

The expression looks something like this:  Sign(Aggr(Sum(value),dimension))

I'm looking for a clean way of translating the returned values (again, 1,0,-1, or null) to a meaningful value to the users; e.g. Gainers,Losers,No Change, or Not Applicable.  I know I can do this with nested If statements, but looking for a better/simpler way.  I can't move this into the script because it is dynamic based on selections.

Any ideas much appreciated!  -Isaiah

1 Solution

Accepted Solutions
danielact
Partner - Creator III
Partner - Creator III

Try using a pick/match combination:

pick(match(Sign(Aggr(Sum(value),dimension)),1,0,-1),'Gainer','No Change','Loser',)

You'll need one if statement for the null values, as I don't believe match works with null values.

View solution in original post

2 Replies
danielact
Partner - Creator III
Partner - Creator III

Try using a pick/match combination:

pick(match(Sign(Aggr(Sum(value),dimension)),1,0,-1),'Gainer','No Change','Loser',)

You'll need one if statement for the null values, as I don't believe match works with null values.

isaiah82
Creator III
Creator III
Author

That does it; thanks!  I ended up using RangeMax around the Aggr() to accommodate the nulls (I gave them a value of -2.)