Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello! I have table:
userID | DealID |
---|---|
1 | 1 |
1 | 2 |
1 | 3 |
1 | 4 |
1 | 5 |
In visual layer, i want use concat function to get measure like this:
userID | DealID |
---|---|
1 | 1;2;3;4 |
And, i want restrict Concat formula to take only first 4 DealID. How to make this?
Always 4 first? Here is a simple way:
=FirstSortedValue(DealID,DealID,1) &'; '& FirstSortedValue(DealID,DealID,2) &'; '& FirstSortedValue(DealID,DealID,3) &'; '& FirstSortedValue(DealID,DealID,4)
Ok, that was simplyfied example. In real case i need first 100 IDs
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)
Dimension
UserID
Expression
Concat(If(Rank(-DealID) < 5, DealID, ', ')
I think you would need this then
Concat( aggr(If(Rank(-DealID) < 5, DealID),userID, DealID), ', ')