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: 
evgeniystuchalk
Partner - Creator II
Partner - Creator II

concat only first X records

Hello! I have table:

userIDDealID
11
12
13
14
15

In visual layer, i want use concat function to get measure like this:

userIDDealID
11;2;3;4

And, i want restrict Concat formula to take only first 4 DealID. How to make this?

5 Replies
Anonymous
Not applicable

Always 4 first?  Here is a simple way:

=FirstSortedValue(DealID,DealID,1) &'; '& FirstSortedValue(DealID,DealID,2) &'; '& FirstSortedValue(DealID,DealID,3) &'; '& FirstSortedValue(DealID,DealID,4)

evgeniystuchalk
Partner - Creator II
Partner - Creator II
Author

Ok, that was simplyfied example. In real case i need first 100 IDs

swuehl
MVP
MVP

Maybe like

LOAD userID,

     DealID,

     AutoNumber(recno(), userID) as Dealorder

FROM

[https://community.qlik.com/thread/248140]

(html, codepage is 1252, embedded labels, table is @1);

Then:

Dimension:

userID

Expression:

=Concat({<Dealorder = {"<=4"}>}DealID, ';', Dealorder)

sunny_talwar

Dimension

UserID

Expression

Concat(If(Rank(-DealID) < 5, DealID, ', ')

swuehl
MVP
MVP

I think you would need this then

Concat( aggr(If(Rank(-DealID) < 5, DealID),userID, DealID), ', ')