Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Top Nth value in text object

Hi All,

We have a chart, where we have kept the dimension limit as 7.

We want to showcase the 1st to 7th value in three different text objects, from the chart.

I have used the FirstSortedValue() function, and it works fine for 1st to 4th.

For 5th, 6th and 7th value, it giving me 'Null' values in text object, as all of them have same metric value.

As per one of the post, I have tried to use 'DISTINCT' keyword, still values not matching with chart.

Could you please assist me on same.

Thanks & Regards,

MK

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Thanks to all, for your reply.

finally I found a solution using below link:

Displaying the Top Salesperson in a Textbox

Just a change in the expression of Rank, we will have to add the Offset value as 4, to get the value in text object.

View solution in original post

17 Replies
sunny_talwar

Can you share the expression you are using in the chart and in the text box object?

florentina_doga
Partner - Creator III
Partner - Creator III

or aggr functiin. pls add am exemple.

trdandamudi
Master II
Master II

Please share your current expression.

Anonymous
Not applicable
Author

in the chart -

count({<Dim2={'A'}>}Dim1) /

count(TOTAL {<Dim2={'A'}, Dim3=>}Dim1)

This is the because, the chart based on Dim3 and I want to have percentage w.r.t others.

In Text Object-

FirstSortedValue(DISTINCT Dim3,

aggr(count({<Dim2={'A'}>}Dim1) /

count(TOTAL {<Dim2={'A'}, Dim3=>}Dim1) ,Dim3),5)


I have tried this, sorry, as i have not written the aggregated dimension name

sunny_talwar

Can you try this:

FirstSortedValue({<Dim2={'A'}>} DISTINCT Dim3, Aggr(Count({<Dim2={'A'}>}Dim1)/Count(TOTAL {<Dim2={'A'}, Dim3=>}Dim1), AggrgatingDimensionNameHere) ,5)

Anonymous
Not applicable
Author

I tried that, but no luck...

I tried to get the rank in chart, and the rank is 4-7 for 4th to 7th value.

When we consider Dimension limit, by default, 7 values coming.

Need inputs for 5th, 6th and 7th.

Kushal_Chawda

try this

or define your actual Dimension in Aggr fucntion

FirstSortedValue(DISTINCT Dim3,

aggr(count({<Dim2={'A'}>}Dim1) /

count(TOTAL {<Dim2={'A'}, Dim3=>}Dim1),Dim3) ,5)

Kushal_Chawda

or

Please provide some of the sample data with expected output so that it will be easy to provide the solution

sunny_talwar

Did you replace this -> AggrgatingDimensionNameHere with the chart dimension/s?