Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
praveensprabhu
Contributor
Contributor

Need help to pick latest 2 field values

Hello Qlik experts,

I am working on a application, where in I am required to pick 2 latest supplier values from a available list along with only one latest sqe_name.

I am showcasing below sample data using which if some1 could help me achieve this.

praveensprabhu_1-1613649444119.png

in the above screenshot, data is sorted in desc order and the top 2 suppliers and top1 sqe needs to displayed as below-

praveensprabhu_2-1613649738327.png

Another example - 

data table sorted by date in desc order

praveensprabhu_3-1613650248321.png

 final output should look like this - 

praveensprabhu_4-1613650361215.png

 

Could some1 please help me to achieve this? 

I am attaching the sample data for reference. 

Labels (2)
1 Solution

Accepted Solutions
saran7de
Master
Master

Try this,

supplier1: FirstSortedValue(supplier_name,-date)

supplier2: FirstSortedValue(supplier_name,-date,2)

sqe: If(IsNull(FirstSortedValue(sqe_name,-date)),FirstSortedValue(sqe_name,-date,2),FirstSortedValue(sqe_name,-date))

View solution in original post

3 Replies
madhu_r
Contributor III
Contributor III

Hi Praveen,

Use the expression to get top 1 supplier:- Aggr(Only({<date={"$(=Max(date))"}>}supplier_name),supplier_name)

top 2 supplier:- Aggr(Only({<date={"$(=Date(Max(date,2)))"}>}supplier_name),supplier_name)

Please find the attached working file.

 

saran7de
Master
Master

Try this,

supplier1: FirstSortedValue(supplier_name,-date)

supplier2: FirstSortedValue(supplier_name,-date,2)

sqe: If(IsNull(FirstSortedValue(sqe_name,-date)),FirstSortedValue(sqe_name,-date,2),FirstSortedValue(sqe_name,-date))

View solution in original post

saran7de
Master
Master

Output:

commQV05.PNG