Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Paneze
Contributor II
Contributor II

Rank Dimension Using Concat Aggr If Rank

Hi everyone, 

I have a dimension called trust, and a measure called target met. I have 5 distinct value sin the Trust dimension. I would like to rank the values in trust from highest Target Met to Lowest in a text box so that it looks like this.

1. A

2. B

3. C

4. E

5. F

 

A Qlik community member kindly shared this expression with me

=concat(aggr(if( rank(sum([Target met]),4)<=6,rank(sum([Target met]),4)&'. '&TRUST), TRUST),chr(10))

But the thread was marked as solved before I tried the formula.

 

Unfortunately this creates a gap, something to do with tied values. The text box looks instead something like this

1.A

2.B

3.C

4.D

5.

6.E

 

Is there a way to get rid of this gap?

 

Thank you

Labels (3)
2 Solutions

Accepted Solutions
MayilVahanan

Hi @Paneze 

I think, you have null values or missing value in your data model for Trust, In that case, might be, below expression helps you

=concat(aggr(if( rank(sum({<TRUST={"=Len(Trim(TRUST))>0"}>}[Target met]),4)<=6,rank(sum({<TRUST={"=Len(Trim(TRUST))>0"}>}[Target met]),4)&'. '&TRUST), TRUST),chr(10))

If not, please attach sample data 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

Paneze
Contributor II
Contributor II
Author

Thank you so much it worked !! Didn't consider that some values might have this field as blank as there is an 'Other' category.

View solution in original post

3 Replies
MayilVahanan

Hi @Paneze 

I think, you have null values or missing value in your data model for Trust, In that case, might be, below expression helps you

=concat(aggr(if( rank(sum({<TRUST={"=Len(Trim(TRUST))>0"}>}[Target met]),4)<=6,rank(sum({<TRUST={"=Len(Trim(TRUST))>0"}>}[Target met]),4)&'. '&TRUST), TRUST),chr(10))

If not, please attach sample data 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Paneze
Contributor II
Contributor II
Author

Thank you so much it worked !! Didn't consider that some values might have this field as blank as there is an 'Other' category.

MayilVahanan

Happy that, you've learnt new way for checking the issue 😀

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.