Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to look-up a value, peek?

Using example data:

MovieStats:
Load MovieTitle,
Min(RTS) As MinScore,
Max(RTS) As MaxScore
Resident Movie
;

How could I look up and display the MovieTitle for both MinScore and MaxScore?

I have tried to implement Peek() but it does not seem like the correct approach.  For purposes of setting a Refrence Line Expression on Line Graph.

Thx

3 Replies
swuehl
MVP
MVP

Using FirstSortedValue:

MovieStats:
Load

Firstsortedvalue(MovieTitle, RTS) as MinTitle,

Firstsortedvalue(MovieTitle, -RTS) as MaxTitle,

Min(RTS) As MinScore,
Max(RTS) As MaxScore
Resident Movie
;

Not applicable
Author

This works, in case where there is only one value.

For example, if multiple records have an RTS of 100, how could I provide a list?  Or maybe just sort and provide the 1st instance?

Thanks!

swuehl
MVP
MVP

For a list:

MovieStats:

JOIN (Movie)

Load
Min(RTS) As MinScore,
Max(RTS) As MaxScore
Resident Movie
;


MovieResult:

LOAD *,

     If(RTS = MinScore, MovieTitle) as MinTitleList,

     If(RTS =MaxScore, MovieTitle) as MaxTitleList

RESIDENT Movie;


DROP TABLE Movie;


Or, a pure front end solution like

=Concat({<RTS = {$(=Max({1} RTS))}>} DISTINCT MovieTitle,', ')

=Concat({<RTS = {$(=Min({1} RTS))}>} DISTINCT MovieTitle,', ')