Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Purushothaman
Partner - Creator III
Partner - Creator III

Highlight the "Highest Ranking" among the 2/3

Hi Experts,

Below is my dataset:

Purushothaman_0-1677662852313.png

 

I would like to Highlight the Highest "Audience Sensor Ranking" among the 2/3 0f "Count(AudienceID)"

Purushothaman_1-1677663049284.png

I have attached the QVF file as well.

Anyone, Please help!!

Thank you!!

 

 

 

 

3 Replies
AustinSpivey
Partner - Creator
Partner - Creator

What do you mean by "the 2/3 0f "Count(AudienceID)"? Do you mean "two-thirds?" Or do you mean the "second and third?" Do you want to "return the highest "Audience Sensor Ranking" ranked by [Sensor Rating] where the =Count(AudienceID) is in the bottom two-thirds grouped by [Audience Sensor Ranking]"?

 

Austin Spivey | Principal Consultant @ Arc Analytics
ArcAnalytics.us | Add me on LinkedIn
Purushothaman
Partner - Creator III
Partner - Creator III
Author

Hi @AustinSpivey ,

Sorry for the late reply. I am looking for this.

Do you want to "return the highest "Audience Sensor Ranking" ranked by [Sensor Rating] where the =Count(AudienceID) is in the bottom two-thirds grouped by [Audience Sensor Ranking]"?

 

Request you to please help!!

Thank you!!

AustinSpivey
Partner - Creator
Partner - Creator

In that case, you can try to use something like this:

=FirstSortedValue({<
[Audience Censor Rating]={"=Count(AudienceID) <= Fractile( total Aggr( Count(AudienceID), [Audience Censor Rating] ) , 2/3 )"}
>} total distinct [Audience Censor Rating], -[Censor Ranking])

There are 2 important things happening here:

  1. The Set Analysis shown above is using the Fractile() function, which allows you to tell the point in a distribution of values at which n% of values fall beneath it. In our case, we use this:
Fractile( total Aggr( Count(AudienceID), [Audience Censor Rating] ) , 2/3 )

...because it tells us the point at which 66.666% of Count(AudienceID) values grouped by [Audience Censor Rating] fall beneath. The rest of that set analysis, =Count(AudienceID) <=, is going to help us return only the Censor Ratings where the count of AudienceID fell into the lower 66.666%.

2. The other important part of this whole expression is the FirstSortedValue() function, which allows up to return a value in a field based on the another field after it's sorted. In our case, we use this:

=FirstSortedValue({<...>} total distinct [Audience Censor Rating], -[Censor Ranking])

...because we want to return the value of [Audience Censor Rating] after the [Censor Ranking] is sorted such that its highest number is used. We ensure that we get the highest [Censor Ranking] by putting the minus sign in front of it (otherwise it uses the lowest value). We use the total and distinct keywords to ensure that only get a single value returned and have it essentially disregard the chart's dimensions.

So ultimately, you can use a Background Color expression like this:

If([Audience Censor Rating] =
FirstSortedValue({<
[Audience Censor Rating]={"=Count(AudienceID) <= Fractile( total Aggr( Count(AudienceID), [Audience Censor Rating] ) , 2/3 )"}
>} total distinct [Audience Censor Rating], -[Censor Ranking])
, Magenta()
)

 

Austin Spivey | Principal Consultant @ Arc Analytics
ArcAnalytics.us | Add me on LinkedIn