Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Thathayoyo
Contributor III
Contributor III

How to stop Concat() function from ordering values i select?

Hello,

 

I have a table :

[Table]:

LOAD * INLINE [Dim,DimID

NameA, A

NameB, B

NameC, C

NameD, D];

 

This Table is put in a filter and so i can select values of [Dim] inside the filter. I want to know what is the first value i select so I use this expression: SubField(Concat([DimID], '|',', '),'|',1). 

For example if I select in first 'NameB' and then second 'NameA' in the filter, i want my expression return B. The problem is that Concat() all time order value so i obtain A as the result. How can i do to stop Concat() to order values?

 

Thanks.

 

Labels (6)
1 Solution

Accepted Solutions
marcus_sommer

It's each time a new calculation against the current selection state and therefore concat() must re-order the included values.

To track the order in which dimensionn-values are selected you may use the appropriate set analysis feature within the identifier of {$1} respectively {$_1} to query the previous/following selection state - and then querying the n states against each other.

But if your scenario isn't a rather simple case it may become ugly with a lot of (nested) if-loops. 

View solution in original post

3 Replies
Kushal_Chawda

@Thathayoyo  try below

=Only({<Dim = {"$(=trim(SubField(GetFieldSelections(Dim),',',-1)))"}>}DimID)
Thathayoyo
Contributor III
Contributor III
Author

Hello thank but GetFieldSelections() also order automatically values so it does not works.

marcus_sommer

It's each time a new calculation against the current selection state and therefore concat() must re-order the included values.

To track the order in which dimensionn-values are selected you may use the appropriate set analysis feature within the identifier of {$1} respectively {$_1} to query the previous/following selection state - and then querying the n states against each other.

But if your scenario isn't a rather simple case it may become ugly with a lot of (nested) if-loops.