Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
kira_whopper
Creator
Creator

Rank for only first - Straight table chart

Hi there,

I'm trying to create a column in a straight table for showing the market leader of a certain dimension.

In other words:

Dimension is Molecule, then I have the Molecule Sales (Sum(sales)), then I need the name of the Corporation which Rank(TOTAL <Molecule> Sum(sales)) = 1 and then this Corporation's Sales.

What I achieved so far is to show the market leader in a text object only when one molecule is selected, using this:

Only(

Aggr(

if(

Rank(TOTAL

Sum( IMP_VL_DEMAND_MTH)

) = 1,

Corporation

), Corporation

)

)

But this does not work in the straight table chart.

I've created an example (attached).

While selecting MolA, the straight table should display CorpH and the sales value of 918,98. This should happen without having to select the molecule.

Any ideas?

1 Solution

Accepted Solutions
Clever_Anjos
Employee
Employee

Try

Market Leader:

FirstSortedValue(Corporation,-Aggr(Sum(Sales),Molecule,Corporation))

View solution in original post

5 Replies
Clever_Anjos
Employee
Employee

Try

Market Leader:

FirstSortedValue(Corporation,-Aggr(Sum(Sales),Molecule,Corporation))

kira_whopper
Creator
Creator
Author

Works as a charm! Thanks a lot!

Used this for the market leader sales:
FirstSortedValue(Aggr(Sum(Sales),Molecule,Corporation),-Aggr(Sum(Sales),Molecule,Corporation))

Clever_Anjos
Employee
Employee

>>"Used this for the market leader sales:"

I that case I think that

Max(Aggr(Sum(Sales),Molecule,Corporation)) should perform better

kira_whopper
Creator
Creator
Author

arvind1494
Specialist
Specialist

TRY THIS ONE.

FirstSortedValue(Corporation,-Aggr(Sum(Sales),Molecule,Corporation))