Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

maxsheva
Contributor

Get Max field value with the Max result in an expression

Hi,

Plan:

LOAD * INLINE [

Channel, Plan

Retail, 100

E-commerce, 50

Wholesale, 20

];

Concatenate(Plan)

Fact:

LOAD * INLINE [

Channel, Fact

Retail, 70

E-commerce, 20

Wholesale, 20

];

PlanFact:

LOAD Channel,

  sum(Fact)/sum(Plan) as Result

Resident Plan Group by Channel;


Drop Table Plan;

I need get value in Text object from a 'Channel' field with the maximum result.


In this case must be "Wholesale"


If possible please add it to the file.

Thx.

1 Solution

Accepted Solutions
MVP
MVP

Re: Get Max field value with the Max result in an expression

May be this

=FirstSortedValue(Channel, -Aggr(sum(Fact)/sum(Plan), Channel))

3 Replies
craigsutton
Contributor

Re: Get Max field value with the Max result in an expression

FirstSortedValue(Channel, -Result)

maxsheva
Contributor

Re: Get Max field value with the Max result in an expression

It works fine.

But I missed something.

Result calculation is in Variable

vResult = sum(Fact)/sum(Plan)

Below variant doesn't work.

FirstSortedValue(Channel, -$(vResult))

MVP
MVP

Re: Get Max field value with the Max result in an expression

May be this

=FirstSortedValue(Channel, -Aggr(sum(Fact)/sum(Plan), Channel))