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: 
kevbrown
Creator II
Creator II

Expression -1

Hi

I have a table in excel that shows Name and another table that shows Name, Rank, Value. What I need to do is create a table in QV that shows Name, Rank, Value, Rank -1 (so if I'm rank 3, I need Rank 2), the Value and Name for that rank

For Value I think I need something like =if(Rank-1=Rank, Value)

For Name I think I need something like =if(Rank-1=Rank, Name) but I'm having no joy

3 Replies
sunny_talwar

Would you be able to share some sample data with expected output from that data?

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Well, for one thing whenever the expression engine evaluates a comparison like "Rank -1 = Rank" it will always return false as there is no value for which this comparison returns true.

I guess that - given the nature of the associative model - it will be very difficult to make this work on the fly. You can easily create a correct table in your LOAD script. The best way to get an example is to follow Sunny's advice and post some source data.

swuehl
MVP
MVP

Yes, context is important...

I may be wrong, but maybe it's enough to create a straight table chart with dimension Name and as expressions:

=Only(Value)

and

=Only(Rank)

Sort your table by Rank expression ascending.

Now you can use chart inter record functions like Above() to address the values in the line above the current:

=Above( Only(Value) )

=Above( Only(Name) )

Similar could be achieved in the script using inter record functions Previous() or Peek() in a sorted table load.