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

Announcements
AWS Degraded - You may experience Community slowness, timeouts, or trouble accessing: LATEST HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
jessica_webb
Creator III
Creator III

Using rank for conditional show

Ultimately, I want to create QV reports displayed on dynamic selections.

I've thought long and hard about how to do this, and think I might have a possible solution, but I'm struggling to implement it.

The selections will be made in a list box (which must remain in alphabetical order):

VALUES

A

B

C

D

So far, I have come up with the use of RANK to get where I need.

So, if I use the expression

IF(GetSelectedCount(VALUES)>=1, RANK(VALUES))

Then selecting A, C and D gives me

VALUESRANK
A1
C2
D3

Selecting B and D gives me

VALUESRANK
B1
D2

Now, what I want to do, is use this dynamic 'Rank value' to conditionally show either an expression or a dimension.

I have tried

(VALUES='A' and IF(GetSelectedCount(VALUES)>=1, RANK(VALUES))=1)

for an expression that specifies VALUES 'A' through set analysis, and

(VALUES='B' and IF(GetSelectedCount(VALUES)>=1, RANK(VALUES))=1)

for an expression that specifies VALUES 'B' through set analysis... etc


What I would expect (or hope!) from this, is for the first selection shown (selecting A, C and D)

is that only the expression for VALUES A to work

And for the second selection shown (selecting B and D)

only the expression for VALUES B to work


What actually happens is nothing shows... If I ONLY select VALUES A, then VALUES A expression works. Or, if I ONLY select VALUES B, then VALUES B expression works. But if I select more than one VALUES, then 'All expressions disabled'.


I would like to be able to change the conditional expression for different charts, so that in some cases the expression only shows if the VALUES is 2nd, or 3rd, or 4th selected in the list... So it will (I presume) need to be based on some kind of ranking.


Some help with this, or alternative suggestions, would be greatly appreciated!


Thanks,

Jess

11 Replies
morganaaron
Specialist
Specialist

Count({<VALUES={"$(=SubField(Concat(VALUES, '|'), '|', 2))"}>} RESULTS)

Should also do it - Stefan's formula is correct - this isn't an intended way to write it (" isn't used for that purpose here) but the syntax checker should like this if you're fussy about the underlines!

jessica_webb
Creator III
Creator III
Author

Thanks Aaron.

It was kind of working without the quotation marks (in fact I'd mistakenly typed it without even single quote marks at the beginning/end) - but the font was grey italic (like when you type a variable name), and I kept getting a 'Exceeded allocated memory' warning.

But with the quotation marks it's working without any issues, so thanks for the edit!

Jess